Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐞]Vite Import for q-astro-manifest.json failing #207

Closed
Shane-Donlon opened this issue Jan 1, 2025 · 21 comments
Closed

[🐞]Vite Import for q-astro-manifest.json failing #207

Shane-Donlon opened this issue Jan 1, 2025 · 21 comments

Comments

@Shane-Donlon
Copy link

Which component is affected?

Build process

Describe the bug

Getting the below error on starting dev server.

@qwikdev/astro: This integration requires Node version 22 or higher. If this is local, check your node version with node -v. If this is a deployment, check your deployment provider's environment variables.

https://github.com/QwikDev/astro/blob/main/libs/qwikdev-astro/server.ts#L76

Full error

Error in import manifestPath of @qwikdev/astro:  Error: Cannot find module '${location of stuff}testing2/node_modules/@qwikdev/astro/q-astro-manifest.json' imported from '${location of stuff}/testing2/node_modules/@qwikdev/astro/server.ts'
    at fetchModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/chunks/dep-0AosnpPU.js:51415:19)
    at RunnableDevEnvironment.fetchModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/chunks/dep-0AosnpPU.js:52491:12)
    at fetchModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/chunks/dep-0AosnpPU.js:52449:21)
    at handleInvoke (file:///${location of stuff}testing2/node_modules/vite/dist/node/chunks/dep-0AosnpPU.js:44162:28)
    at EventEmitter.listenerForInvokeHandler (file:///${location of stuff}testing2/node_modules/vite/dist/node/chunks/dep-0AosnpPU.js:44235:25)
    at EventEmitter.emit (node:events:518:28)
    at Object.send (file:///${location of stuff}testing2/node_modules/vite/dist/node/chunks/dep-0AosnpPU.js:30701:40)
    at Object.invoke (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:610:34)
    at Object.invoke (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:671:34)
    at SSRCompatModuleRunner.getModuleInformation (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1193:94) {
  code: 'ERR_MODULE_NOT_FOUND',
  runnerError: Error: RunnerError
      at reviveInvokeError (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:541:18)
      at Object.invoke (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:624:15)
      at async SSRCompatModuleRunner.getModuleInformation (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1193:73)
      at async request (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1215:88)
      at async Object.renderToStaticMarkup (eval at runInlinedModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1050:11), <anonymous>:40:29)
      at async renderFrameworkComponent (eval at runInlinedModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1050:11), <anonymous>:217:26)
      at async renderComponent (eval at runInlinedModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1050:11), <anonymous>:370:10)
      at async renderChild (eval at runInlinedModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1050:11), <anonymous>:11:13)
}
Error in renderToStaticMarkup function of @qwikdev/astro:  Error: @qwikdev/astro: This integration requires Node version 22 or higher. If this is local, check your node version with node -v. If this is a deployment, check your deployment provider's environment variables.
    at Object.renderToStaticMarkup (eval at runInlinedModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1050:11), <anonymous>:51:13)
    at async renderFrameworkComponent (eval at runInlinedModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1050:11), <anonymous>:217:26)
    at async renderComponent (eval at runInlinedModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1050:11), <anonymous>:370:10)
    at async renderChild (eval at runInlinedModule (file:///${location of stuff}testing2/node_modules/vite/dist/node/module-runner.js:1050:11), <anonymous>:11:13)
10:37:06 [ERROR] @qwikdev/astro: This integration requires Node version 22 or higher. If this is local, check your node version with node -v. If this is a deployment, check your deployment provider's environment variables.
  Stack trace:
    at ${location of stuff}testing2\eval at runInlinedModule (file:\${location of stuff}\testing2\node_modules\vite\dist\node\module-runner.js:1050:11
    [...] See full stack trace in the browser, or rerun with --verbose.

Reproduction

this cannot be blank

Steps to reproduce

npm create @qwikdev/astro@latest

Create a project

npm run start / npm run dev

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
    Memory: 439.29 MB / 7.74 GB
  Binaries:
    Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.14.2 - ~\AppData\Roaming\npm\pnpm.CMD
    bun: 1.1.38 - ~\AppData\Roaming\npm\bun.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)

Additional Information

Hey Jack 👋

I was looking into this and was thinking of migrating the import to Node, this seems to work for me locally, and I can do a local build.

Example code:
https://github.com/QwikDev/astro/blob/main/libs/qwikdev-astro/server.ts#L76

    let integrationManifest: JSON | null = null;
    if (manifestPath) {
      try {

        if (fs.existsSync(manifestPath)) {
          const fileContents = fs.readFileSync(manifestPath, 'utf-8');
          integrationManifest = JSON.parse(fileContents);
        }
      } catch (error) {

Let me know if you want a PR etc..

Just trying to start contributing with code as well as issues.
Happy new year 🥳

@thejackshelton
Copy link
Member

This should work in a node environment already, which is why I don't seem to understand the issue.

Also we don't want node being the only thing that can run in Qwik Astro's server runtime. It would work in this case, but not be ideal in the integration.

Do you have a minimal reproduction link I can look at?

@Shane-Donlon
Copy link
Author

re:node statement: That's fair, I was certain this is what would have been said, but did want to try and throw some solution at it.

Absolutely I didn't realise the CLI had changed since logging the issue
Original Template
https://github.com/Shane-Donlon/testing-qwik-astro-stuff-issue-207

Netlify Deployment:
https://github.com/Shane-Donlon/testing-qwik-astro-stuff-issue-207-netlify
Side note:
Site deployed but it has failed site is blank.

https://eclectic-dango-67483d.netlify.app/

Sorry for the spam looking link, default netlify link.

@thejackshelton
Copy link
Member

thejackshelton commented Jan 2, 2025

re:node statement: That's fair, I was certain this is what would have been said, but did want to try and throw some solution at it.

Absolutely I didn't realise the CLI had changed since logging the issue Original Template https://github.com/Shane-Donlon/testing-qwik-astro-stuff-issue-207

Netlify Deployment: https://github.com/Shane-Donlon/testing-qwik-astro-stuff-issue-207-netlify Side note: Site deployed but it has failed site is blank.

https://eclectic-dango-67483d.netlify.app/

Sorry for the spam looking link, default netlify link.

Is the issue in both the project and netlify deploy? Or only a specific place?

@Shane-Donlon
Copy link
Author

Shane-Donlon commented Jan 2, 2025

re:node statement: That's fair, I was certain this is what would have been said, but did want to try and throw some solution at it.

Absolutely I didn't realise the CLI had changed since logging the issue Original Template https://github.com/Shane-Donlon/testing-qwik-astro-stuff-issue-207

Netlify Deployment: https://github.com/Shane-Donlon/testing-qwik-astro-stuff-issue-207-netlify Side note: Site deployed but it has failed site is blank.

https://eclectic-dango-67483d.netlify.app/

Sorry for the spam looking link, default netlify link.

Is the issue in both the project and netlify deploy? Or only a specific place?

The issue is in both versions.
Was just testing if it was development only. But seems to be both Development & Production.

Literally I haven't touched the projects in any way.

Replication steps:
Follow the CLI select "no" on template,
run Dev server.
See errors.

@thejackshelton
Copy link
Member

I followed the steps here and was unable to reproduce, making me think there's something specific to your environment affecting this 🤔

@Shane-Donlon
Copy link
Author

I followed the steps here and was unable to reproduce, making me think there's something specific to your environment affecting this 🤔

This is very interesting!
deployed via vercel

See "internal server error" in screenshot above.

Can you try to deploy to Vercel / Netlify?
Netlify Failed for me yesterday and Vercel today.

But that could be me doing something wrong either.

Vercel link
https://testing-207.vercel.app/

Repo link
https://github.com/Shane-Donlon/testing-207

@thejackshelton
Copy link
Member

thejackshelton commented Jan 3, 2025

I'll take a look here soon 😄 .

And just checking, you have an environment variable that sets vercel's node version to 22?

One thing we could do, is do a node readFile and then have a setting in the integration to use a dynamic json import instead when that doesn't work.

So:

error. then error says: Are you using node? If not, please do node: false in the Qwik Astro integration, or something similar.

@thejackshelton
Copy link
Member

Hey @Shane-Donlon! Let me know if the latest version fixed your issue.

@Shane-Donlon
Copy link
Author

Shane-Donlon commented Jan 4, 2025

Hey @Shane-Donlon! Let me know if the latest version fixed your issue.

Edit 2
So locally SSR and SSG work fine (dev server only didn't build)
Production is a different story.

SSG Works in both Netlify and Vercel

SSR Fails in both Netlify and Vercel.

Vercel errors are better so showing this one.

SSG Repo:
https://github.com/Shane-Donlon/testing-207-vercel-ssg

SSG Link:
https://testing-207-vercel-ssg.vercel.app/

SSR Repo:
https://github.com/Shane-Donlon/testing-207-replication-dot-slash

SSR link:
https://testing-207-replication-dot-slash.vercel.app/

@Shane-Donlon
Copy link
Author

And just checking, you have an environment variable that sets vercel's node version to 22?

Just to come back on this,
yes confirmed. Node 22 is the default version in Vercel and this is confirmed in all my project settings
(even the 207 repos above)

confirmation image

https://vercel.com/docs/functions/runtimes/node-js/node-js-versions#default-and-available-versions

@thejackshelton
Copy link
Member

Hey @Shane-Donlon! Let me know if the latest version fixed your issue.

Edit 2 So locally SSR and SSG work fine (dev server only didn't build) Production is a different story.

SSG Works in both Netlify and Vercel

SSR Fails in both Netlify and Vercel.

Vercel errors are better so showing this one.

SSG Repo: https://github.com/Shane-Donlon/testing-207-vercel-ssg

SSG Link: https://testing-207-vercel-ssg.vercel.app/

SSR Repo: https://github.com/Shane-Donlon/testing-207-replication-dot-slash

SSR link: https://testing-207-replication-dot-slash.vercel.app/

You should see an error in the server logs. What was the error?

@Shane-Donlon
Copy link
Author

?
Error below.

I'm on my phone so forgive the formatting

Error in renderToStaticMarkup function of @qwikdev/astro: Error: @qwikdev/astro: Failed to read the q-astro-manifest.json file. This file is required for the @qwikdev/astro integration to work. It seems like you're using node. If this is not the case, please set the isNode option to false in the integration options in astro.config.mjs. Also make sure this is the case with both your local and deployed environment. at Object.renderToStaticMarkup (file:///var/task/dist/server/chunks/server_COsjBHlt.mjs:4736:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async renderFrameworkComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1969:26) at async renderComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:2122:10) at async renderChild (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1285:13)

17:12:51.536

There was an uncaught error in the middle of the stream while rendering /. Error: @qwikdev/astro: Failed to read the q-astro-manifest.json file. This file is required for the @qwikdev/astro integration to work. It seems like you're using node. If this is not the case, please set the isNode option to false in the integration options in astro.config.mjs. Also make sure this is the case with both your local and deployed environment. at Object.renderToStaticMarkup (file:///var/task/dist/server/chunks/server_COsjBHlt.mjs:4736:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async renderFrameworkComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1969:26) at async renderComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:2122:10) at async renderChild (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1285:13)

@thejackshelton
Copy link
Member

?
Error below.

I'm on my phone so forgive the formatting

Error in renderToStaticMarkup function of @qwikdev/astro: Error: @qwikdev/astro: Failed to read the q-astro-manifest.json file. This file is required for the @qwikdev/astro integration to work. It seems like you're using node. If this is not the case, please set the isNode option to false in the integration options in astro.config.mjs. Also make sure this is the case with both your local and deployed environment. at Object.renderToStaticMarkup (file:///var/task/dist/server/chunks/server_COsjBHlt.mjs:4736:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async renderFrameworkComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1969:26) at async renderComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:2122:10) at async renderChild (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1285:13)

17:12:51.536

There was an uncaught error in the middle of the stream while rendering /. Error: @qwikdev/astro: Failed to read the q-astro-manifest.json file. This file is required for the @qwikdev/astro integration to work. It seems like you're using node. If this is not the case, please set the isNode option to false in the integration options in astro.config.mjs. Also make sure this is the case with both your local and deployed environment. at Object.renderToStaticMarkup (file:///var/task/dist/server/chunks/server_COsjBHlt.mjs:4736:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async renderFrameworkComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1969:26) at async renderComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:2122:10) at async renderChild (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1285:13)

Could be that when Vercel or Netlify make their own directory for their serverless functions the q-astro-manifest path is lost 🤔

Will have a version for you to try soon

@thejackshelton
Copy link
Member

Try https://pkg.pr.new/QwikDev/astro/@qwikdev/astro@212

@Shane-Donlon
Copy link
Author

?
Error below.

I'm on my phone so forgive the formatting

Error in renderToStaticMarkup function of @qwikdev/astro: Error: @qwikdev/astro: Failed to read the q-astro-manifest.json file. This file is required for the @qwikdev/astro integration to work. It seems like you're using node. If this is not the case, please set the isNode option to false in the integration options in astro.config.mjs. Also make sure this is the case with both your local and deployed environment. at Object.renderToStaticMarkup (file:///var/task/dist/server/chunks/server_COsjBHlt.mjs:4736:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async renderFrameworkComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1969:26) at async renderComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:2122:10) at async renderChild (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1285:13)

17:12:51.536

There was an uncaught error in the middle of the stream while rendering /. Error: @qwikdev/astro: Failed to read the q-astro-manifest.json file. This file is required for the @qwikdev/astro integration to work. It seems like you're using node. If this is not the case, please set the isNode option to false in the integration options in astro.config.mjs. Also make sure this is the case with both your local and deployed environment. at Object.renderToStaticMarkup (file:///var/task/dist/server/chunks/server_COsjBHlt.mjs:4736:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async renderFrameworkComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1969:26) at async renderComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:2122:10) at async renderChild (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1285:13)

Could be that when Vercel or Netlify make their own directory for their serverless functions the q-astro-manifest path is lost 🤔

Will have a version for you to try soon

Thanks!

You might need to wrap the isNode (what you added yesterday) with ' if isDev && isNode' for local Dev server.

@thejackshelton
Copy link
Member

?
Error below.

I'm on my phone so forgive the formatting
Error in renderToStaticMarkup function of @qwikdev/astro: Error: @qwikdev/astro: Failed to read the q-astro-manifest.json file. This file is required for the @qwikdev/astro integration to work. It seems like you're using node. If this is not the case, please set the isNode option to false in the integration options in astro.config.mjs. Also make sure this is the case with both your local and deployed environment. at Object.renderToStaticMarkup (file:///var/task/dist/server/chunks/server_COsjBHlt.mjs:4736:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async renderFrameworkComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1969:26) at async renderComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:2122:10) at async renderChild (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1285:13)
17:12:51.536
There was an uncaught error in the middle of the stream while rendering /. Error: @qwikdev/astro: Failed to read the q-astro-manifest.json file. This file is required for the @qwikdev/astro integration to work. It seems like you're using node. If this is not the case, please set the isNode option to false in the integration options in astro.config.mjs. Also make sure this is the case with both your local and deployed environment. at Object.renderToStaticMarkup (file:///var/task/dist/server/chunks/server_COsjBHlt.mjs:4736:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async renderFrameworkComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1969:26) at async renderComponent (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:2122:10) at async renderChild (file:///var/task/dist/server/chunks/astro/server_bR_VmPe9.mjs:1285:13)

Could be that when Vercel or Netlify make their own directory for their serverless functions the q-astro-manifest path is lost 🤔
Will have a version for you to try soon

Thanks!

You might need to wrap the isNode (what you added yesterday) with ' if isDev && isNode' for local Dev server.

I was never able to reproduce in dev. I do have a reproduction of the issue in vercel here.

Looks like we still have the issue. Making another link for verbose logging.

@thejackshelton
Copy link
Member

Try this one https://pkg.pr.new/QwikDev/astro/@qwikdev/astro@331fa9b

@thejackshelton
Copy link
Member

Yeah it seems vercel is moving it to the wrong location:

qAstroManifestPath /vercel/path0/dist/client/q-astro-manifest.json

@Shane-Donlon
Copy link
Author

Try this one https://pkg.pr.new/QwikDev/astro/@qwikdev/astro@331fa9b

I know you're still messing around with things,
But just FYI I am getting this error in dev.

 npm run dev

> dev
> astro dev

ENOENT: no such file or directory, open '{location of stuff}\.qwik-212\dist\q-astro-manifest.json'

Updated dependencies

 "dependencies": {
    "@astrojs/check": "^0.9.4",
    "@builder.io/qwik": "^1.12",
    "@qwikdev/astro": "https://pkg.pr.new/QwikDev/astro/@qwikdev/astro@331fa9b",
    "astro": "^5.1"
  },

npm install
npm run dev
error appears in vscode terminal

@thejackshelton
Copy link
Member

Ok just tested and this looks to be fixed on @qwikdev/astro version 0.7.7

Let me know if that's not the case and I can re-open or create a new issue

@Shane-Donlon
Copy link
Author

Ok just tested and this looks to be fixed on @qwikdev/astro version 0.7.7

Let me know if that's not the case and I can re-open or create a new issue

Yeah seems to be fixed.

This is what I tested.

SSG in Dev
SSR in Dev

SSG in Production (Netflify)
SSR in Production (Netflify)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants