Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone mode and experimental-edge API route shows trace warning #42899

Closed
1 task done
Thisisjuke opened this issue Nov 14, 2022 · 14 comments
Closed
1 task done

Standalone mode and experimental-edge API route shows trace warning #42899

Thisisjuke opened this issue Nov 14, 2022 · 14 comments
Labels
Output (export/standalone) Related to the the output option in `next.config.js`.

Comments

@Thisisjuke
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #59-Ubuntu SMP Fri Sep 9 09:37:59 UTC 2022
Binaries:
  Node: 16.14.0
  npm: 8.3.1
  Yarn: 1.22.19
  pnpm: 7.15.0
Relevant packages:
  next: 13.0.3
  eslint-config-next: 13.0.3
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

next build (to test in local) / Vercel + github

Describe the Bug

When I build my app locally and start it : loclahost:3000/api/og displays my OG card.

work locally using yarn build && yarn start

My website is well deployed (no error on Vercel during build) but going to /api/og raise a 500 error.

500 error when I go to url mywebsite.vercel.app/api/og

Sequel of this thread here that has been closed: #41968

Expected Behavior

My deployed website should deploy

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/Thisisjuke/nextjs-og-next13-bug-reproduction

To Reproduce

Everything like: #41968

@brightonmike has the same issue but this one was closed 2 weeks ago and we don't have any news in the previous thread.

@Thisisjuke Thisisjuke added the bug Issue was opened via the bug report template. label Nov 14, 2022
@balazsorban44
Copy link
Member

balazsorban44 commented Nov 14, 2022

Do you have a link to your deployment? 🤔 Your reproduction seems to work fine here: https://nextjs-42899-ahhsrnevq-balazsorban.vercel.app/api/og

Can you also check your logs on Vercel and comment here what the 500 error said?

@balazsorban44 balazsorban44 added the please add a complete reproduction The issue lacks information for further investigation label Nov 14, 2022
@Thisisjuke
Copy link
Author

@balazsorban44 I updated nextjs to the canary version.

yarn add next@canary

It's seems that the difference is that that error is now a warning :

[Error: ENOENT: no such file or directory, open '/path/repo/.next/server/pages/api/og.js.nft.json']

Local build information:

$ next build
info  - Linting and checking validity of types  
warn  - You are using an experimental edge runtime, the API might change.
info  - Creating an optimized production build ..<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (176kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
info  - Creating an optimized production build  
info  - Compiled successfully
warn  - Failed to copy traced files for /path/repo/.next/server/pages/api/og.js [Error: ENOENT: no such file or directory, open '/path/repo/.next/server/pages/api/og.js.nft.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/path/repo/.next/server/pages/api/og.js.nft.json'
}
info  - Collecting page data  
info  - Generating static pages (3/3)
info  - Finalizing page optimization  

Route (pages)                              Size     First Load JS
┌ ○ /                                      2.79 kB        81.5 kB
├ ○ /404                                   212 B            79 kB
└ ℇ /api/og                                0 B            78.8 kB
+ First Load JS shared by all              78.8 kB
  ├ chunks/framework-aefaf282dc32bbc7.js   45.7 kB
  ├ chunks/main-7f6b386ee2fd6a88.js        31.8 kB
  ├ chunks/pages/_app-ef9da0a6572b3989.js  243 B
  └ chunks/webpack-2369ea09e775031e.js     1.02 kB

ℇ  (Streaming)  server-side renders with streaming (uses React 18 SSR streaming or Server Components)
○  (Static)     automatically rendered as static HTML (uses no initial props)

Done in 8.30s.

Vercel build logs:

info  - Collecting page data...
--
17:07:06.457 | warn  - Failed to copy traced files for /vercel/path0/.next/server/pages/api/og.js [Error: ENOENT: no such file or directory, open '/vercel/path0/.next/server/pages/api/og.js.nft.json'] {
17:07:06.457 | errno: -2,
17:07:06.457 | code: 'ENOENT',
17:07:06.457 | syscall: 'open',
17:07:06.457 | path: '/vercel/path0/.next/server/pages/api/og.js.nft.json'
17:07:06.457 | }
17:07:06.513 | info  - Generating static pages (0/3)
17:07:06.641 | info  - Generating static pages (3/3)
17:07:06.652 | info  - Finalizing page optimization...
17:07:06.657 |  
17:07:06.686 | Route (pages)                              Size     First Load JS
17:07:06.686 | ┌ ○ /                                      2.79 kB        81.5 kB
17:07:06.687 | ├ ○ /404                                   212 B            79 kB
17:07:06.687 | └ ℇ /api/og                                0 B            78.8 kB
17:07:06.687 | + First Load JS shared by all              78.8 kB
17:07:06.687 | ├ chunks/framework-aefaf282dc32bbc7.js   45.7 kB
17:07:06.687 | ├ chunks/main-7f6b386ee2fd6a88.js        31.8 kB
17:07:06.687 | ├ chunks/pages/_app-ef9da0a6572b3989.js  243 B
17:07:06.687 | └ chunks/webpack-2369ea09e775031e.js     1.02 kB
17:07:06.688 |  
17:07:06.688 | ℇ  (Streaming)  server-side renders with streaming (uses React 18 SSR streaming or Server Components)
17:07:06.688 | ○  (Static)     automatically rendered as static HTML (uses no initial props)
17:07:06.688 |  
17:07:06.849 | Done in 15.41s.
17:07:07.109 | Collected static files (public/, static/, .next/static): 2.515ms
17:07:07.147 | Build Completed in /vercel/output [49s]

It's working on my side with "next": "^13.0.3-canary.4",
Previous was: "next": "^13.0.1-canary.0",

@balazsorban44
Copy link
Member

It's working on my side with "next": "^13.0.3-canary.4",

Does this mean the issue is fixed now? 🤔

I have no such logs as shown above using our latest canary either.

@brightonmike
Copy link

brightonmike commented Nov 14, 2022

For me I am on 12.2.3 which apparently it supports: https://vercel.com/docs/concepts/functions/edge-functions/og-image-generation

It doesn't work at all and upgrading to 13 isn't an option for my project (it's a vast codebase about to go live in a matter of 2/3 weeks). We're on Netlify so I'm wondering if that's why, although it also doesn't work locally.

@balazsorban44
Copy link
Member

@brightonmike see #41968 (comment). Given the OP's repro and 12.2.3, it still works, both locally, and on Vercel. It's likely a Netlify-related issue and should be reported there.

@Thisisjuke
Copy link
Author

Thisisjuke commented Nov 14, 2022

Does this mean the issue is fixed now? 🤔

I don't think it's fixed, just that the error does not create an internal 500 error anymore 🤔 ? I am ok with this solution on a short term: I can see my OG card in staging environment = my task is done atm. But not really confident to go live with hidden errors inside .next folder 😿

We're on Netlify so I'm wondering if that's why

I wish you good luck because their support will not necessarily be relevant on this kind of error: the support on the forum does not seem to be up to date on the subjects announced during the last nextJs conference... Fix your error localy and then try a deploy on Netlify, then a deploy on Vercel : if things are working out of the box on Vercel but break on Netlify, there is an error on Netlify side.

⚠️ I was on Netlify before and switched to Vercel and then to a self hosted container : their Netlify functions (your pages/api/...) don't include all your dependencies out of the box.

@brightonmike

This comment was marked as off-topic.

@Thisisjuke
Copy link
Author

@brightonmike can you paste here the content of your /api/og.tsx please ?

I tried many things days ago I might be able to help you. Their are some CSS rules that are not availables and break your /api/og route (like some CSS gradients).

First thing to do is to create a clean repo and paste your content in /api/og.tsx. If it's working it may be a problem with another of your dependencies.

@brightonmike

This comment was marked as off-topic.

@balazsorban44
Copy link
Member

But not really confident to go live with hidden errors inside .next folder 😿

@Thisisjuke can you help me understand this?

Given #42899 (comment), I still cannot reproduce this, neither locally, nor on Vercel. 🤔. Could you try deleting the .next folder locally before next build and re-deploy on Vercel without the build cache, to see if that makes a difference? Otherwise, a link/access to your deployment would be helpful so we can further investigate. 🙏

@Thisisjuke
Copy link
Author

Hi, I created a branch on the reproduction repository: https://github.com/Thisisjuke/nextjs-og-next13-bug-reproduction/tree/repro/issue-42899

There is this warning during the build about this path ENOENT: no such file or directory, open '/path/nextjs-og-next13-bug-reproduction/.next/server/pages/api/og.js.nft.json :

warn  - Failed to copy traced files for /path/nextjs-og-next13-bug-reproduction/.next/server/pages/api/og.js [Error: ENOENT: no such file or directory, open '/path/nextjs-og-next13-bug-reproduction/.next/server/pages/api/og.js.nft.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/path/nextjs-og-next13-bug-reproduction/.next/server/pages/api/og.js.nft.json'
}
info  - Collecting page data  
info  - Generating static pages (3/3)
info  - Finalizing page optimization  

Route (pages)                              Size     First Load JS
┌ ○ /                                      2.79 kB        81.5 kB
├ ○ /404                                   212 B            79 kB
└ ℇ /api/og                                0 B            78.8 kB
+ First Load JS shared by all              78.8 kB
  ├ chunks/framework-aefaf282dc32bbc7.js   45.7 kB
  ├ chunks/main-7f6b386ee2fd6a88.js        31.8 kB
  ├ chunks/pages/_app-ef9da0a6572b3989.js  243 B
  └ chunks/webpack-2369ea09e775031e.js     1.02 kB

You can try it with :

  • yarn
  • yarn build

@balazsorban44 balazsorban44 added please add a complete reproduction The issue lacks information for further investigation Output (export/standalone) Related to the the output option in `next.config.js`. and removed please add a complete reproduction The issue lacks information for further investigation labels Nov 15, 2022
@balazsorban44
Copy link
Member

balazsorban44 commented Nov 15, 2022

Thanks, so using the reproduction, I could finally reproduce the issue (conclusion, always start with including a proper, minimal reproduction for faster resolution), here is a minimal version: https://github.com/balazsorban44/nextjs-42899

It seems to be an issue with experimental-edge enabled in the API route and using the output: "standalone" option, which was missing in the description's repro.

It's unrelated to @vercel/og.

@balazsorban44 balazsorban44 added kind: bug and removed please add a complete reproduction The issue lacks information for further investigation bug Issue was opened via the bug report template. labels Nov 15, 2022
@balazsorban44 balazsorban44 changed the title Vercel : Deployed @vercel/og crashed a 500 on production Standalone mode and experimental-edge API route shows trace warning Nov 15, 2022
@balazsorban44
Copy link
Member

Actually, this is a duplicate of #39275, so closing in favor of that. 👍

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Output (export/standalone) Related to the the output option in `next.config.js`.
Projects
None yet
Development

No branches or pull requests

3 participants