basics / nuxt-booster

nuxt-booster will help you to improve the lighthouse performance score (100/100) of your website. 🚀
https://basics.github.io/nuxt-booster/
MIT License
667 stars 32 forks source link

Failed with nuxt layers and cloudflare deploy #1149

Open xusimr97 opened 4 weeks ago

xusimr97 commented 4 weeks ago

If i create a new nuxt layer, and install this module. when i deploy it to cloud flare i get a 500.

steps to reproduce: -npx nuxi init --template layer test-layer

this is my simple nuxt.config.ts: // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ devtools: { enabled: true }, modules: [ 'nuxt-booster' ], nitro: { "preset": "cloudflare_pages", } })

This is the error i get: "logs": [ { "message": [ "[nuxt] [request error] [unhandled] [500]", "Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler. https://developers.cloudflare.com/workers/runtime-apis/handlers/\n at NodeCache._checkData (chunks/build/entry-CmUIuQz0.mjs:1:13649) \n at new NodeCache (chunks/build/entry-CmUIuQz0.mjs:1:10529) \n at chunks/build/entry-CmUIuQz0.mjs:1:36371" ], "level": "error", "timestamp": 1729796801922 }, { "message": [ "[nuxt] [request error] [unhandled] [500]", "Cannot access 'e' before initialization\n at chunks/build/server.mjs:1:3572 \n at async entry (chunks/build/server.mjs:1:3508) \n at async Object.renderToString (chunks/routes/renderer.mjs:1:3863) \n at async chunks/routes/renderer.mjs:1:113319 \n at async Object.handler (chunks/routes/renderer.mjs:1:112193) \n at async Object.handler (chunks/runtime.mjs:1:74005) \n at async chunks/runtime.mjs:1:77142 \n at async chunks/runtime.mjs:1:109480 \n at async errorHandler (chunks/runtime.mjs:1:105423) \n at async chunks/runtime.mjs:1:77294" ], "level": "error", "timestamp": 1729796801922 } ],

This only happens with this module, if i dissable it it works well

ThornWalli commented 3 weeks ago

Hello @xusimr97,

You can test the next release. I have removed node-cache there.

npm i nuxt-booster@3.1.7-next.1