Open farnabaz opened 3 months ago
- Operating System: Darwin - Node Version: v20.11.1 - Nuxt Version: 3.12.1 - CLI Version: 3.12.0 - Nitro Version: 2.10.0-28638494.93d002b7 - Package Manager: pnpm@9.1.3
Live: https://7b85d7f1.nuxthub.pages.dev/ Faced on https://github.com/nuxt-hub/platform/pull/203
Deploying project to Cloudflare pages result undefined error because event.context.nitro is undefined.
event.context.nitro
I made a little patch that handles the undefined error. This might not be the correct solution for this issue but as a workaround it works fine
diff --git a/dist/runtime/internal/config.mjs b/dist/runtime/internal/config.mjs index f4314c748192ce0fe2fd72bb61de28fa8b70f1eb..c8c508297723568bbc1b817b14c89f1d691868a7 100644 --- a/dist/runtime/internal/config.mjs +++ b/dist/runtime/internal/config.mjs @@ -14,11 +14,12 @@ export function useRuntimeConfig(event) { if (!event) { return _sharedRuntimeConfig; } - if (event.context.nitro.runtimeConfig) { + if (event.context.nitro?.runtimeConfig) { return event.context.nitro.runtimeConfig; } const runtimeConfig = klona(_inlineRuntimeConfig); applyEnv(runtimeConfig, envOptions); + event.context.nitro = event.context.nitro || {}; event.context.nitro.runtimeConfig = runtimeConfig; return runtimeConfig; }
No response
Environment
Reproduction
Live: https://7b85d7f1.nuxthub.pages.dev/ Faced on https://github.com/nuxt-hub/platform/pull/203
Describe the bug
Deploying project to Cloudflare pages result undefined error because
event.context.nitro
is undefined.I made a little patch that handles the undefined error. This might not be the correct solution for this issue but as a workaround it works fine
Additional context
No response
Logs
No response