next-on-pages icon indicating copy to clipboard operation
next-on-pages copied to clipboard

[🐛 Bug]: nextjs local preview succeeded, deployment succeeded, but no deployment was shown

Open hehehai opened this issue 10 months ago • 15 comments

next-on-pages environment related information

System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 32 GB Shell: /bin/zsh Package Manager Used: npm (10.1.0)

Relevant Packages: @cloudflare/next-on-pages: 1.11.0 vercel: N/A next: N/A

Description

developed the nextjs project, using pages deployment, the first deployment was successful, but after my subsequent modifications, the deployment was successful, but accessing pages failed

image

Reproduction

https://github.com/hehehai/at4-kit

name = "at4-start"
compatibility_date = "2024-04-05"
compatibility_flags = ["nodejs_compat"]

[vars]
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY = "pk_test_xx"
CLERK_SECRET_KEY = "sk_test_xx"

[[d1_databases]]
binding = "DB" # i.e. available in your Worker on env.DB
database_name = "prisma-demo-db"
database_id = "xx"
"pages:build": "npx @cloudflare/next-on-pages",
"preview": "npm run pages:build && wrangler pages dev .vercel/output/static",
"deploy": "npm run pages:build && wrangler pages deploy .vercel/output/static",
"build-cf-types": "wrangler types --env-interface CloudflareEnv env.d.ts"

Pages Deployment Method

None

Pages Deployment ID

at4-start

Additional Information

No response

Would you like to help?

  • [ ] Would you like to help fixing this bug?

hehehai avatar Apr 10 '24 15:04 hehehai

image image

hehehai avatar Apr 11 '24 01:04 hehehai

I'm running into the same issue. However, manually uploading the .vercel/output/static folder into the Cloudflare dashboard seems to work.

In particular, that upload has a _worker.js folder that's missing from the CLI upload, even though it seems to show up under "Attaching additional modules:", so maybe that's broken?

liuhenry avatar Apr 11 '24 22:04 liuhenry

@liuhenry Yes, I have used manual upload, but I have the same problem. I think it is the built file that is not parsed properly. Pages does not think it is a service.

hehehai avatar Apr 12 '24 00:04 hehehai

Manual upload won't deploy the worker, it will just upload everything as static assets. The _worker.js folder should not be shown in your list of assets on Pages.

Please can you share deployment IDs for the failing deployments?

james-elicx avatar Apr 12 '24 17:04 james-elicx

@james-elicx What is the id you are talking about? Is it this one?

at4-start.pages.dev

image

Twice I modified the path, and the path was changed to, He successfully displayed the deployment preview address, but it was inaccessible (this is normal)

"deploy": "npm run pages:build && wrangler pages deploy .vercel/output",

Previously, I used full stack Next.js to initialize the project, and the deployment was normal

hehehai avatar Apr 13 '24 00:04 hehehai

@james-elicx Hello, would like to know if there are any current solutions or suggestions for this problem?

hehehai avatar Apr 19 '24 08:04 hehehai

Do you have a solution when I encounter the same situation?

hocgin avatar Apr 19 '24 16:04 hocgin

@james-elicx

I guess the reason for the problem is caused by a combination of nextjs, Prisma, and d1.

This is the smallest problem reproduction demo I have created: https://github.com/hocgin/issue-cloudflare-nextjs-prisma-d1

Where the problem occurred: https://github.com/hocgin/issue-cloudflare-nextjs-prisma-d1/blob/bbc5013d02487554ac39f494ee3f4017cb416485/app/api/hello/route.ts#L12

Deployment ID: 6b32578d-be85-4bf0-9310-e518b5c451dd

Looking forward to receiving a solution to the problem

hocgin avatar Apr 20 '24 02:04 hocgin

Do you have a solution when I encounter the same situation?

No, it's on hold

hehehai avatar Apr 21 '24 00:04 hehehai

Getting this same issue as well but when using Drizzle ORM in an RSC.

LightBounded avatar Apr 21 '24 09:04 LightBounded

Same

bradens avatar Apr 21 '24 19:04 bradens

@hehehai I've had a similar issue than you (build does not error, deploy does not error , but the deployment appears fully broken with all paths returning 404).

I've created a PR that makes sure the build exits with code 1 when erroring unexpectedly. If this is the exact same issue you and the other users are having, there's obviously still something that is causing the build to fail and this PR will just make sure it doesn't go through as a broken deployment causing an incident.

It'd be helpful to see your pages:build logs, specially after ▲ Build Completed in .vercel/output [4m]

▲ Collected static files (public/, static/, .next/static): 59.326ms
▲ Build Completed in .vercel/output [4m]
⚡️ Completed `pnpm dlx vercel build`.
⚡️ Unexpected error: <----- do you have something like this?

juanferreras avatar Apr 22 '24 12:04 juanferreras

@hehehai I've had a similar issue than you (build does not error, deploy does not error , but the deployment appears fully broken with all paths returning 404).

I've created a PR that makes sure the build exits with code 1 when erroring unexpectedly. If this is the exact same issue you and the other users are having, there's obviously still something that is causing the build to fail and this PR will just make sure it doesn't go through as a broken deployment causing an incident.

It'd be helpful to see your pages:build logs, specially after ▲ Build Completed in .vercel/output [4m]

▲ Collected static files (public/, static/, .next/static): 59.326ms
▲ Build Completed in .vercel/output [4m]
⚡️ Completed `pnpm dlx vercel build`.
⚡️ Unexpected error: <----- do you have something like this?

@juanferreras No, it's like this

▲  ƒ Middleware                             222 kB
▲  ℇ  (Edge Runtime)  server-rendered on demand using the Edge Runtime
▲  Traced Next.js server files in: 336.634ms
▲  Created all serverless functions in: 362.769ms
▲  Collected static files (public/, static/, .next/static): 5.529ms
▲  Build Completed in .vercel/output [37s]
⚡️ Completed `pnpm exec vercel build`.

⚡️ Build Summary (@cloudflare/next-on-pages v1.11.0)
⚡️
⚡️ Middleware Functions (1)
⚡️   - src/middleware
⚡️
⚡️ Edge Function Routes (7)

...
✨ Deployment complete! Take a peek over at https://5585e299.at4-start.pages.dev

hehehai avatar Apr 22 '24 13:04 hehehai

@juanferreras Any solutions or plans for liberation? Do you know the specific reason now? If it cannot be reproduced, can I use the repo reproduction I provide?

hehehai avatar Apr 30 '24 08:04 hehehai

Still getting this same issue. Has anyone found a solution or reason for why this is happening?

LightBounded avatar Jun 22 '24 14:06 LightBounded