[v4][Vue warn]: provide() can only be used inside setup() with the Nuxt3
See original GitHub issueWhat happened?
I have implemented a simple page that uses useField according to this document.
I deployed the above page to AWS Lambda using Nuxt(3.0.0-rc.4) Nitro, and I am getting following warnings during SSR(This does not occur during client-side rendering).
Curiously, this problem does not occur on a local server started by nuxt dev
.
[Vue warn]: provide() can only be used inside setup()
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: onMounted is called when there is no active component instance to be associated with.
index.vue
<template>
<div>
<input v-model="value" />
<span>{{ errorMessage }}</span>
</div>
</template>
<script>
import { useField } from 'vee-validate';
export default {
setup() {
// a simple `name` field with basic required validator
const { value, errorMessage } = useField('name', (inputValue) => !!inputValue);
return {
value,
errorMessage,
};
},
};
</script>
My apologies if this is not a bug in vee-validate. Any help would be greatly appreciated.
Reproduction steps
- Implement the sample page.
- Build the app by the
nuxt build
- Deploy the app to AWS Lambda . …
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
- Firefox
- Chrome
- Safari
- Microsoft Edge
Relevant log output
[Vue warn]: provide() can only be used inside setup()
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: inject() can only be used inside setup() or functional components.
[Vue warn]: onMounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.
### Demo link
no link
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](CONDUCT.md)
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
A error in Nuxt3 · Discussion #5427 · nuxt/framework - GitHub
I was trying out nuxt3-rc3 and three.js, but suddenly I faced this error: ... [Vue warn]: inject() can only be used inside setup()...
Read more >Vue 3 - inject() can only be used inside setup or functional ...
My app makes an await api call to the backend and if there is an error calls my composition function. [Vue warn]: inject()...
Read more >Vue 3 - inject() can only be used inside setup() or functional ...
My app makes an await api call to the backend and if there is an error calls my composition function. [Vue warn]: inject()...
Read more >Installation - Nuxt
Creating a Nuxt project from scratch only requires one file and one directory. We will use the terminal to create the directories and...
Read more >Introduction to Nuxt 3 modules - DEV Community
In this article, we will be taking a look at @nuxtjs/strapi module as it is Nuxt 3 compatible, very well developed and documented....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks like a Nuxt caveat since there isn’t a way to force vee-validate and nuxt to use the same Vue instance.
A current workaround recommended by them is to add
build.transpile
with an array of libraries that import Vue themselves.I tried running the server locally and warnings are gone once I added
vee-valdiate
tobuild.transpile
. Can you try that and let me know?Closing this for now, LMK if that doesn’t work for you and I will re-open and check.
I think monorepo problem. @logaretm
https://github.com/huntersofbook/huntersofbook/blob/78bc2b1bae60e711aa74c04da6eaf01f0617209d/apps/playground/vite.config.ts#L16-L18
add and fixid.