Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update og generation code with local assets (#64888)
### What? This PR fixes OpenGraph generation code with local assets in Node.js runtime. Also adds some notes on file location. The updated code is validated with my project on vercel. ### Why? I tried loading a file in `public` folder(say `./public/og.png`). The Node.js local assets example code did work locally with `next start` but failed with error message `Error: ENOENT: no such file or directory` when deployed to vercel. Then I found out the trick here is the relative path. On my local machine the CWD is the root folder so the relative path works, And it seems the CWD is somewhat different on vercel runtime. Then I tried using `process.cwd()` to get the CWD and construct a absolute path, this has been validated with my project on vercel. Also it's worthy to note where the local assets should be placed, so that devs could be less confused. --------- Co-authored-by: Steven <steven@ceriously.com> Co-authored-by: JJ Kasper <jj@jjsweb.site>
- Loading branch information