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

[nuxt] [request error] [unhandled] [500] _fetch is not a function #27413

Closed
lxccc812 opened this issue May 31, 2024 · 3 comments
Closed

[nuxt] [request error] [unhandled] [500] _fetch is not a function #27413

lxccc812 opened this issue May 31, 2024 · 3 comments

Comments

@lxccc812
Copy link

lxccc812 commented May 31, 2024

Environment


  • Operating System: Windows_NT
  • Node Version: v18.18.2
  • Nuxt Version: 3.9.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: pnpm@8.9.2
  • Builder: -
  • User Config: modules, ssr, runtimeConfig, app, css, devServer, devtools, device, experimental, gtm, nitro, pwa, site, sitemap
  • Runtime Modules: nuxt-swiper@1.2.2, @unocss/nuxt@0.57.7, @vueuse/nuxt@10.7.2, @nuxtjs/device@3.1.1, @vite-pwa/nuxt@0.6.0, @nuxtjs/sitemap@5.0.4, @zadigetvoltaire/nuxt-gtm@0.0.13
  • Build Modules: -

Reproduction

Sorry, I can't provide Reproduction because I don't have this error locally with pnpm build && node .output/server/index.mjs, it only occurs in live production

Describe the bug

When I do something like this for a dynamic routing page, I repack and deploy the service with pm2, and I see an error on the homepage, or any other page that uses useFetch (but the f12 console doesn't throw any errors). I've also tried deleting the 'node_modules' file and rebuilding, and I've also removed the '.output' and '.nuxt' and rebuilt.

Additional context

Attached my changes, only this small change, but my website is not working.
image

Logs

[nuxt] [request error] [unhandled] [500] _fetch is not a function
  at ufetch (./.output/server/chunks/nitro/node-server.mjs:2718:14)  
  at localFetch (./.output/server/chunks/nitro/node-server.mjs:6907:39)  
  at sendProxy (./.output/server/chunks/nitro/node-server.mjs:1810:47)  
  at proxyRequest (./.output/server/chunks/nitro/node-server.mjs:1798:10)  
  at Object.handler (./.output/server/chunks/nitro/node-server.mjs:5142:14)  
  at Object.handler (./.output/server/chunks/nitro/node-server.mjs:2166:31)  
  at toNodeHandle (./.output/server/chunks/nitro/node-server.mjs:2355:7)  
  at ufetch (./.output/server/chunks/nitro/node-server.mjs:2721:17)  
  at $fetchRaw2 (./.output/server/chunks/nitro/node-server.mjs:2593:26)  
  at $fetch2 (./.output/server/chunks/nitro/node-server.mjs:2635:15)
[nuxt] [request error] [unhandled] [500] _fetch is not a function
  at ufetch (./.output/server/chunks/nitro/node-server.mjs:2718:14)  
  at localFetch (./.output/server/chunks/nitro/node-server.mjs:6907:39)  
  at sendProxy (./.output/server/chunks/nitro/node-server.mjs:1810:47)  
  at proxyRequest (./.output/server/chunks/nitro/node-server.mjs:1798:10)  
  at Object.handler (./.output/server/chunks/nitro/node-server.mjs:5142:14)  
  at Object.handler (./.output/server/chunks/nitro/node-server.mjs:2166:31)  
  at toNodeHandle (./.output/server/chunks/nitro/node-server.mjs:2355:7)  
  at ufetch (./.output/server/chunks/nitro/node-server.mjs:2721:17)  
  at $fetchRaw2 (./.output/server/chunks/nitro/node-server.mjs:2593:26)  
  at $fetchRaw2 (./.output/server/chunks/nitro/node-server.mjs:2602:14)
Copy link
Contributor

github-actions bot commented Jun 1, 2024

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

@manniL
Copy link
Member

manniL commented Jun 1, 2024

I repack and deploy the service with pm2

If it doesn't break locally (given the same node version etc. etc.), then this might be the issue. Worth trying to reproduce the same setup locally.

@lxccc812
Copy link
Author

lxccc812 commented Jun 3, 2024

Yes, you're right, it's me who doesn't have the same version of node locally and online that causes the error.

@lxccc812 lxccc812 closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants