Open dominik-sfl opened 3 years ago
What OS is your machine running? Do you have a package-lock.json?
@Arcath macOS Big Sur 11.4
I do have a yarn.lock
file right here.
I also added a 3rd page to the reproduction repository with this in getServerSideProps:
if(process.platform === "win32"){
process.env.ESBUILD_BINARY_PATH = path.join(process.cwd(), 'node_modules', 'esbuild', 'esbuild.exe')
}else{
process.env.ESBUILD_BINARY_PATH = path.join(process.cwd(), 'node_modules', 'esbuild', 'bin', 'esbuild')
}
I thought it might have to do with the ESBUILD_BINARY_PATH
, but it gives me the same error about esbuild-linux-64
.
Also did another reproduction using npm
instead of yarn
, but it's exactly the same problem:
with NPM : https://github.com/dominik-sfl/next-mdx-bundler-npm Demo with NPM : https://next-mdx-bundler-npm.vercel.app/
Issue seems to appear in 6.0.3 as well. Works exceptionally well in getStaticProps
but chokes on getServerSideProps
@AnthonyKuang Yes, exactly. Downgrading esbuild seems to work for me though. Downgraded to 0.12.09 and it's working again.
I must confess to not really knowing what "NFT" is, but I'm guessing this may be relevant?
https://github.com/vercel/nft/pull/262
(I'm also running into the same issue, found that pull request and related issues whilst searching for a solution :))
The fix for me was adding "esbuild": "^0.19.5",
mdx-bundler
version: 7.0.0node
version: v14.15.4npm
version: 7.24.0Relevant code or config
Just copy pasted from the mdx-bundler github example:
What you did:
I'm trying to use mdx-bundler server side in NextJS' getServerSideProps. Everything works fine when I keep things static (with getStaticProps), but I get a 500 error when I try to access the same page using getServerSideProps. All works on my machine (both in dev & when built), but not on Vercel.
What happened:
Reproduction repository:
https://github.com/dominik-sfl/next-mdx-bundler Demo here: https://next-mdx-bundler.vercel.app/
Problem description:
mdx-bundler works in Next.JS on Vercel with getStaticProps, but not with getServerSideProps. Everything fine on my local machine.
Suggested solution: