-
Notifications
You must be signed in to change notification settings - Fork 27k
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-1087] Next OpenGraph Image not working with basePath #49162
Comments
Note: Just upgraded to NextJS 13.3.4. This is still a problem, even it being now stable. |
Thanks for reporting, will take a look! 13.4.x is not on npm yet (by the time we comment), but will def follow up to get the fix out asap in later patches 🙏 |
@huozhi My mistake, now I oficially tested 13.4, and it's still a problem! :p Thank you for taking a look! |
The fix is landed in 13.4.1-canary.1 |
Awesome, thanks for doing it so quick! @huozhi |
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. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:41 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8103 Binaries: Node: 18.15.0 npm: 9.5.0 Yarn: 1.22.19 pnpm: 8.3.1 Relevant packages: next: 13.3.4 eslint-config-next: 13.3.4 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://github.com/josepholiveira/next13-opengraph-image-basepath-bug
To Reproduce
localhost:3000/test
(/test is the basePath in next.config.js)Describe the Bug
When using the NextJs app folder, with the Metadata API, we can create files named
opengraph-image.(jpg|jpeg|png|gif)
, it works like a charm but not when setting up a basePath in thenext.config.js
file.Giving an example, when not using the basePath, the image is added like this to the og:image field:
http://localhost:3000/opengraph-image-1vqp9l.jpg?d41089021927a9d2
But when using the basePath, accessing this URL is not valid and it will not work, but when trying to access manually adding the basePath to the URL, it works:
http://localhost:3000/test/opengraph-image-1vqp9l.jpg?d41089021927a9d2
But NextJS is currently, despite setting up the basePath in next.config.js, not adding the basePath automatically when we use the opengraph-image.
Also, adding here, another bug is that it always considers
3000
as the port, but I was using 3001 that was another reason it didn't work locally.Expected Behavior
I expected Next to automatically handle the basePath for the opengraph-image.
Which browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
Vercel
NEXT-1087
The text was updated successfully, but these errors were encountered: