-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
[NEXT-1102] opengraph-image
is 404 in route group segments, both image and dynamic
#48106
Comments
opengraph-image
is always 404, both image and dynamicopengraph-image
is always 404 in route group segments, both image and dynamic
opengraph-image
is always 404 in route group segments, both image and dynamicopengraph-image
is 404 in route group segments, both image and dynamic
I guess this is related : #48081 |
This issue is fixed by #47985 |
@huozhi on version 13.4.1, not fixed. |
@filingroove We're adding hash suffix for the opengraph-image under group routes now, for my case, If I add an og image I'll see the url I couldn't repro the error in the 2nd picture locally with the codesandbox one. Would you mind sharing a repo with which you bumped to this error that having |
I understand what you're doing :) When I reported the issue, hash suffixes were already added to images under groups. I can't share the repo with you as it's closed source, but I can provide you snippets with the bits you need to solve the issue. Original system I tried and failed on is in the op, it still happens in the sandbox (though error is just 404 there and not "invalid path") and the system now is this:
|
opengraph-image
is 404 in route group segments, both image and dynamicopengraph-image
is 404 in route group segments, both image and dynamic
Looks like your reproduction on stackblitz is using an old canary version. I forked it with lastest version and now can repro with the error on stackblitz
|
It keeps giving different errors on different systems. On Mac I had no error, just 404 in Browser and nothing in terminal output in dev. On Linux it's I know this makes things harder but mb they all have common root. |
For macOS, I'm not sure if it's having the same problem like linux, I couldn't repro with group routes locally.. |
I may have encountered the same problem, but in a slightly different situation. Starting point:
Folder structure (app dir):
Now, when I am trying to access the generated image, I am redirected to the 404 page (as I have a 404 page setup). Sample access url: /projekte/neue-app/opengraph-image When I look at the head tag, I see that the Opengraph image was generated: The problem seems to be the hash suffix which is added to the URL as already mentioned by @huozhi. |
Can confirm this is still not fixed in 13.4.8, any |
I tested it with a |
I think I have the same image as this, has anyone found a good workaround? |
Having the same issue. I'm trying to get the openGraph ordering to work as per the documentation : https://nextjs.org/docs/app/building-your-application/optimizing/metadata#ordering I have a layout which has a default static openGraph image, an index page which has a static openGraph image and a news/[slug] which has a dynamic openGraph image coming from the server. If there is an issue with the dynamic openGraph image, I would like the default image from the layout to be visible, but I keep getting the static image from the home page. I tried putting the home page into a (index) route group with it's opengraph-image.png, but then the home image is no longer showing. Any ideas on how to get this to work ? |
### What Removing the `/[...catchall]/<metadata image convention>.js` case from docs ### Why Since og image and icon routes are using catch-all routes to handle the both single or multiple routes. For instance: `app/opengraph-image.js` can possibly generate two cases: - single route: `/opengraph-image` - multi routes with `generateImageMetadata()`: `/opengraph-image/[id]` We're not able to detect if there's `generateImageMetadata` defined in the file before mapping the routes, and decided to create the different routes to either `/opengraph-image` or `/opengraph-image/[id]`. That's why we're using a catch-all routes to handle them rn. Related #48106 Related #57349
I had this issue until I realized the page i was trying to access was blocked because middleware auth. Please check your middlewares and auth |
Hi everyone— I will be closing this issue since the original issue has since been fixed and there are separate issues that came via the comments. If you have an separate issue you wish to share, please do not hesitate to re-submit a new issue via the bug report. |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 20.6.0: Tue Apr 19 21:04:45 PDT 2022; root:xnu-7195.141.29~1/RELEASE_X86_64 Binaries: Node: 16.19.0 npm: 9.3.1 Yarn: 3.4.1 pnpm: N/A Relevant packages: next: 13.3.1-canary.2 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue
https://stackblitz.com/edit/vercel-next-js-k4rkzr?file=app/(group)/segment/page.tsx
To Reproduce
In any Next.JS 13 project, in
appDir
:(group)
(group)
, create a/segment/page.tsx
/segment/opengraph-image
,(jpg|png|...)
or(js|jsx|tsx)
– doesn't matterDescribe the Bug
While setting
opengraph-image
for a segment in the route group, it doesn't work. You will see a 404 page instead.It is detected and compiled as evidence by the console messages referring to it:
Expected Behavior
opengraph-image
should work the same on any nesting level, in a route group or outside of a route group.Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
NEXT-1102
The text was updated successfully, but these errors were encountered: