nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
802 stars 35 forks source link

Error after deployment #185

Open Lucas-Gruber opened 5 days ago

Lucas-Gruber commented 5 days ago

Describe the bug Hello, i don't really know if this is the right place for this issue.

When i deploy my Nuxt App to NuxtHub, everything seems right but when i want to open the Website i following error:

Error: 500
This page is temporarily unavailable.

But when i deploy my page to Netlify for example or use it local with node it works fine.

And i get an error in server log, but i don't know if this the error.

13:29:08.705
Connected to production deployment logs...

13:29:11.145
   GET 500 /
[nuxt] [request error] [unhandled] [500],Cannot access 'default' before initialization
  at chunks/routes/renderer.mjs:1:25256  
  at async chunks/routes/renderer.mjs:1:25209  
  at async ye (chunks/routes/renderer.mjs:1:26859)  
  at async Object.handler (chunks/routes/renderer.mjs:1:29357)  
  at async Object.handler (chunks/runtime.mjs:1:77446)  
  at async chunks/runtime.mjs:1:80378  
  at async chunks/runtime.mjs:1:130717
[nuxt] [request error] [unhandled] [500],Cannot access 'default' before initialization
  at chunks/routes/renderer.mjs:1:25256  
  at async chunks/routes/renderer.mjs:1:25209  
  at async ye (chunks/routes/renderer.mjs:1:26859)  
  at async Object.handler (chunks/routes/renderer.mjs:1:29357)  
  at async Object.handler (chunks/runtime.mjs:1:77446)  
  at async chunks/runtime.mjs:1:80378  
  at async chunks/runtime.mjs:1:130717  
  at async errorHandler (chunks/runtime.mjs:1:118204)  
  at async chunks/runtime.mjs:1:80530  
  at async chunks/runtime.mjs:1:130717

Steps to reproduce Steps to reproduce the behavior:

  1. Deploy a nuxt app
  2. Try to open it

Expected behavior Website shows the index page.

Barbapapazes commented 4 days ago

Hey 👋,

Could you provide a reproduction? Or the piece of code that generate this?

Lucas-Gruber commented 4 days ago

I am trying to find the piece of code that is causing this.

If not, I'll send the repo of my project.

I'm not at home right now, but I'll do it right after!

Lucas-Gruber commented 4 days ago

I have not yet found the piece of code that is causing the error.

I will continue to test and see if I can find it. In the meantime, I will send my project anyway, as you may know more quickly what the problem is.

Repo: https://github.com/ArisCorporation/Website

Lucas-Gruber commented 3 days ago

Okay, i have an update. The error:

[nuxt] [request error] [unhandled] [500],Cannot access 'default' before initialization
  at chunks/routes/renderer.mjs:1:25256  
  at async chunks/routes/renderer.mjs:1:25209  
  at async ye (chunks/routes/renderer.mjs:1:26859)  
  at async Object.handler (chunks/routes/renderer.mjs:1:29357)  
  at async Object.handler (chunks/runtime.mjs:1:77446)  
  at async chunks/runtime.mjs:1:80378  
  at async chunks/runtime.mjs:1:130717

Is from dayjs-nuxt module.

Now i removed the dayjs module and get now this error:

[nuxt] [request error] [unhandled] [500],Cannot access 'bS' before initialization
  at chunks/routes/renderer.mjs:1:25282  
  at async chunks/routes/renderer.mjs:1:25219  
  at async chunks/routes/renderer.mjs:1:27415  
  at async Object.handler (chunks/routes/renderer.mjs:1:26359)  
  at async Object.handler (chunks/runtime.mjs:1:75815)  
  at async chunks/runtime.mjs:1:78952  
  at async chunks/runtime.mjs:1:128292
[nuxt] [request error] [unhandled] [500],Cannot access 'bS' before initialization
  at chunks/routes/renderer.mjs:1:25282  
  at async chunks/routes/renderer.mjs:1:25219  
  at async chunks/routes/renderer.mjs:1:27415  
  at async Object.handler (chunks/routes/renderer.mjs:1:26359)  
  at async Object.handler (chunks/runtime.mjs:1:75815)  
  at async chunks/runtime.mjs:1:78952  
  at async chunks/runtime.mjs:1:128292  
  at async errorHandler (chunks/runtime.mjs:1:116654)  
  at async chunks/runtime.mjs:1:79104  
  at async chunks/runtime.mjs:1:128292

I haven't found the source of the error yet, but I'm doing my best

Lucas-Gruber commented 3 days ago

I have another update!

I found 2 problems.

  1. The pinia nuxt module is one problem.
  2. And when i have the pnpm lockfile in the repo it brings these weird "cannot access x before intialization". When i delete the lockfile it works fine.
Saganic commented 3 days ago

+1 this appears to be an issue with pnpm.

I have a project with zero additional deps, using npm the build works fine, using pnpm it errors with the same message as OP.

Node version: v21.7.3 pnpm version: 8.6.12 npm version: 10.5.0

{
  "name": "nuxt-app",
  "type": "module",
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@nuxthub/core": "^0.7.0",
    "nuxt": "^3.12.2",
    "vue": "latest"
  },
  "devDependencies": {
    "@antfu/eslint-config": "^2.21.2",
    "eslint": "9.5.0"
  }
}
Lucas-Gruber commented 3 days ago

Alright, unfortunately i cannot use NuxtHub for my project, because it is not possible to use the @directus/sdk with CloudFlare Pages. It doesn't support the credential property and i get this error:

The 'credentials' field on 'RequestInitializerDict' is not implemented

But this isn't a NuxtHub related issue.

mhetreramesh commented 21 hours ago

I am also having same problem for my fresh new application deployed without any additional dependencies, at some point it was working though. Everything works locally but not on cloudflare.

23:07:03.399
Connected to production deployment logs...

23:07:05.391
   GET 500 /
[nuxt] [request error] [unhandled] [500],global is not defined
  at chunks/build/server.mjs:1:157309
[nuxt] [request error] [unhandled] [500],Cannot access 'default' before initialization
  at chunks/routes/renderer.mjs:1:113671  
  at async chunks/routes/renderer.mjs:1:113624  
  at async zn (chunks/routes/renderer.mjs:1:115291)  
  at async Object.handler (chunks/routes/renderer.mjs:1:117789)  
  at async Object.handler (chunks/runtime.mjs:1:74628)  
  at async chunks/runtime.mjs:1:77560  
  at async chunks/runtime.mjs:1:111660  
  at async errorHandler (chunks/runtime.mjs:1:106396)  
  at async chunks/runtime.mjs:1:77712  
  at async chunks/runtime.mjs:1:111660