qwik
qwik copied to clipboard
[✅] fixes for all "Error: Missing Qwik City Env Data"
(If you never seen this error then ignore this)
This is a live thread for different ways to fix Error: Missing Qwik City Env Data which can be caused by many different errors.
Error: Missing Qwik City Env Data
at AsyncFunction.Aa (file:///Temp/server/q-DNo4f3Gn.js:15:11868)
at AsyncFunction.dc (file:///Temp/server/q-DNo4f3Gn.js:10:5874)
at AsyncFunction.V (file:///Temp/server/q-DNo4f3Gn.js:10:5808)
at file:///Temp/server/q-DNo4f3Gn.js:15:2935
at q (file:///Temp/server/q-DNo4f3Gn.js:7:1510)
at file:///Temp/server/q-DNo4f3Gn.js:15:2804
at file:///Temp/server/q-DNo4f3Gn.js:8:4693
at Qt (file:///Temp/server/q-DNo4f3Gn.js:7:1430)
at Et (file:///Temp/server/q-DNo4f3Gn.js:8:4686)
at wi (file:///Temp/server/q-DNo4f3Gn.js:8:9122)
Your error might be one of the many fixes listed below
if any of these fixed your issue add a reaction to this post. Otherwise add a comment if you're still stuck
1. cookie issue
"I faced the same issue, but it was only due to the hostname/domain (localhost) having data of previous app stored in it. It solved itself when I cleared cookies and site data"
clear cookies and site data
2. accidentally importing server-only packages on the client
you might have accidentally imported a server-only package onto the client during development.
move server-only code into routeLoader$ or server$
3. deps in "dependencies" not in "devDependencies"
you might have dependencies in "dependencies" inside package.json that are being excluded. Move the packages into "devDependencies" unless they're server-only packages or packages with production binary e.g "bcrypt"
move app dependencies in package.json into "devDependencies"
4. when resizing window on local dev
sometimes when installing a new qwik app you may see this error when resizing the window. This is sometimes caused when the source-maps aren't loading
restart the dev server (comment here and ping me if this doesn't work)
5. partytown install
when installing qwik party town there can be an error with the QwikPartyTown component
remove <QwikPartytown forward={['dataLayer.push', 'fbq']} /> in root.tsx
@PatrickJS, thank you for creating this thread. But I think it's not a good idea to expect developers to memorize the list you presented. The correct way is to give correct messages. Please let me repeat myself:
The right way is to give correct error messages
That's the first line for troubleshooting and debugging.
yes, this is only temporary until we track down each error and fix them. The error itself is triggered more often by other errors (which we need to correctly capture)
happens all the time in firefox... if you open up devtools automatically does that
there was alot of errors before in dev mode that dont pop up anymore... they still do in the console but before there was an error about some image thing that the dev tools injects some container ( it would mess up my css all the time) maybe whatever was done to mute that started throwing this errors ?
- i like adding grid directly to the body... so i remember that error it was like a container that was like 0px x 0px would sit up in the top left and actually had a flag (tooltip-ish ordeal) that would always be there saying something about image needed width height... but even if you had no images ( pertained to the container itself) it would be there... but that thing would mess up my whole css, but I notice the console, still logs the error... but that little "flag "doesnt show up on the top left, but def when you open up dev tools in firefox the second you open it up it throws the qwik.env error ... something strange tho when in dev mode the vite and qwik trys to throw a bunch of stuff in which is ignored by firefox ( like all the -web kit stuff) .. just kind of seems like thats an "Env" thing + that new qwik.env.d.ts file I keep asking what its about but no one knows
What's the reproduction? Is it just new qwik app 1.5.5 and open dev mode in Firefox
What's the reproduction? Is it just new qwik app 1.5.5 and open dev mode in Firefox
well i just got 1.5.5 and it does the same thing but 15.4 did it do
@JerryWu1234 do you have time to look into this bug?
@JerryWu1234 do you have time to look into this bug?
Ok I can do
everything is fine .
@seanperez-xyz Could you reproduce this bug ?
It happens to me when I use a context provider in the main layout
I just saw another instance of this error triggered when using a hook that returned a single property from a context-bound Store:
export const useFoo = () => {
const store = useContext(MyContext);
return store.foo;
};
The issue was resolved by abandoning the hook and instead retrieving and destructuring the complete store within components:
const { foo } = useContext(MyContext);
I just got it in a new app with
node -v
> v18.17.1
npm create qwik@latest
npx qwik add fastify
And if i hit a 404 route, i.e posting via postman to a random endpoint - i dont get a 404 and instead i get this error.
Qwik version 1.6 is causing this error to appear constantly in my application.
@devcaeg in dev mode or production? Could you make a repro?
After upgrading to 1.6 seems I can not also get rid off this. Dev mode.
I have to re-run "npm start" on every change.
It happens to me in development mode and it is constantly. For the moment I will go back to the previous version, since version 1.6 makes it impossible for me to work.
I will try to make a minimal reproduction of the error so that it can be investigated.
@gioboa I'm also experiencing it but when I revert the assetsDir commit, I don't experience this any more
@gioboa I take that back, it's still broken. Not sure why it worked for a bit.
Went back from 1.6 to 1.5.7. If I have no route [...catchall] I get the same error "Missing Qwik City Env Data for help visit https://github.com/QwikDev/qwik/issues/6237" but If I have a [...catchall] route I get this error "TypeError: error loading dynamically imported module: http://localhost:5173/src/components/ts/global_component_4w7djkoecc8.js%3Ft%3D1719875176718". A fresh 1.6 install has not these problems.
Went back from 1.6 to 1.5.7. If I have no route [...catchall] I get the same error "Missing Qwik City Env Data .....
Can you share with us your repo with the bere minimum stuffs? I would like to face this error because it is so annoying
@wmertens @gioboa
I have created a "minimal" reproduction of the problem.
Go to Stackblitz, and navigate between HOME and LOGIN, make some changes to the files and you will see that at various times the error "Missing Qwik City Env Data" will appear.
https://stackblitz.com/edit/qwik-starter-hakacd?file=src%2Froutes%2Flayout.tsx
PS: The way I have been able to reproduce the error, is to navigate a couple of times between HOME and LOGIN, and then change the text of the "Link" and there appears the error.
Apart from this error, another error "Failed to fetch dynamically imported module" is also being displayed.
As an extra comment, since version 1.6 inside the "entry.ssr" file using "opts.serverData?.qwikcity?.ev?.sharedMap" sometimes returns "undefiend" in previous versions it never returned "undefiend".
Thanks @devcaeg
PS: The way I have been able to reproduce the error, is to navigate a couple of times between HOME and LOGIN, and then change the text of the "Link" and there appears the error.
I'm encountering the same issue. Since version 1.6.0, after making just two or three changes, sometimes with as little as two lines of code, I receive the error message: Failed to fetch dynamically imported module. Restarting npm run dev temporarily resolves the problem, but it's becoming a nightmare.
@CristianMR
For the moment I recommend downgrading to version 1.5.7.
i just had this issue and i did the CTRL+C to npm start and restart it. then it's gone. using the latest qwik
ubuntu 24.04, chrome / brave browser
incognito mode too (i thought it was something with my browser cache but it's the server side)
I'm encountering it when hot reloading. First render, everything is fine, but change some code, and Vite re-runs entry.ssr without providing a request and then the qwik city server data is missing.
Probably the fix is to have module.hot.accept in the right places
@wmertens is there a quick fix i can do now? what do u mean module.hot.accept in the right places?
i'm having this issue persistently. i need to CTRL+C my npm start and restart it again instead of having hot reload
@sprappcom
In the meantime use version 1.5.7 instead of 1.6.