nodejs.org icon indicating copy to clipboard operation
nodejs.org copied to clipboard

No indication of cause when dev deployment is broken

Open JakobJingleheimer opened this issue 11 months ago • 15 comments

URL:

https://nodejs-5gs7cwzc2-openjs.vercel.app/en/learn/typescript/publishing-a-ts-project

Browser Name:

Brave

Browser Version:

1.73.105

Operating System:

macOS

How to reproduce the issue:

When a page can't be generated, the server returns a 500 with no information whatsoever for what went wrong. In a non-production environment, it should include the error that triggered the 500.

Shit happened. Good luck

JakobJingleheimer avatar Feb 02 '25 12:02 JakobJingleheimer

Wath did you receive on terminal ?

AugustinMauroy avatar Feb 02 '25 13:02 AugustinMauroy

Nothing because I don't run it locally; there's no need to do aside from working around this issue.

JakobJingleheimer avatar Feb 02 '25 13:02 JakobJingleheimer

it's not dev env it's vercel preview right ?

AugustinMauroy avatar Feb 02 '25 14:02 AugustinMauroy

Right. So in vercel, set NODE_ENV to "preview" or something, no?

JakobJingleheimer avatar Feb 02 '25 14:02 JakobJingleheimer

Right. So in vercel, set NODE_ENV to "preview" or something, no?

No, if you do npm run dev on local you I'll get error on your terminal. If it's a preview of vercel, it's a preview, maybe there's a log on vercel. But I don't have access to that.

AugustinMauroy avatar Feb 02 '25 15:02 AugustinMauroy

Yes, I understand how to get it when running locally, which I never need to do except when the preview deployment blows up and refuses to tell me what's wrong.

An article editor never needs to run things locally—it's just a markdown file. Article editors maybe need not even be technical, so expecting them to install a bunch of deps, get a local up and running, etc is needlessly onerous.

There's got to be a way to capture the error and return it. IIR, this is the default Next.js error page, which is augmentable. In non-prod, even a rsp.send(500, error) would be a big improvement.

JakobJingleheimer avatar Feb 02 '25 15:02 JakobJingleheimer

An article editor never needs to run things locally—it's just a markdown file. Article editors maybe need not even be technical, so expecting them to install a bunch of deps, get a local up and running, etc is needlessly onerous.

I agree with you.

  • We had a lack of documentation of which code tabs languages is supported. (that your issue I guess).
  • https://github.com/nodejs/nodejs.org/blob/main/apps/site/app/global-error.tsx should handle error that strange.

AugustinMauroy avatar Feb 02 '25 15:02 AugustinMauroy

@AugustinMauroy I also encountered the same problem. May I ask how I should deploy a Node.js website on Vercel?

Image

@JakobJingleheimer May I ask if you have resolved it?

ikxin avatar Mar 10 '25 13:03 ikxin

cc @ovflowd I didn't get what happened here

AugustinMauroy avatar Mar 10 '25 21:03 AugustinMauroy

There are a bunch of environment variables to be setup. You can check next.constants.mjs -- Pretty much you need to provide which URL it should use to self consume its API.

TBH, this repository wasn't designed so that other people can deploy the Node.js website. It was meant only for the Node.js project.

ovflowd avatar Mar 10 '25 22:03 ovflowd

@ovflowd Thank you very much. After I set the NEXT_PUBLIC_BASE_URL environment variable, it can be deployed normally.

ikxin avatar Mar 11 '25 02:03 ikxin

@ovflowd Thank you very much. After I set the NEXT_PUBLIC_BASE_URL environment variable, it can be deployed normally.

That should be the main necessary variable, yes. Interesting that it is not defined, as Vercel defines this variable automatically if the project is built within Vercel.

Are you building it locally and just uploading to Vercel?

ovflowd avatar Mar 11 '25 09:03 ovflowd

Hmm I gotta give a look if we are automatically consuming https://vercel.com/docs/environment-variables/framework-environment-variables#NEXT_PUBLIC_VERCEL_URL as a fallback.

Anyhow, we can revise that logic in a future + adding some extra docs.

But we did not create documentation for third parties to deploy the website.

ovflowd avatar Mar 11 '25 09:03 ovflowd

I was building directly on Vercel by connecting to the Git repository, and it seems that this environment variable was not present. It was only after I manually set this variable that I could access it normally.

ikxin avatar Mar 11 '25 09:03 ikxin

This seems to be veering off-topic @ikxin.

JakobJingleheimer avatar Mar 11 '25 10:03 JakobJingleheimer