Does not work on Vercel inside getServerSideProps from Next.js
See original GitHub issueThanks for making this awesome npm
package! 😄
mdx-bundler
version: 4.0.0node
version: 14.16.1npm
version: 7.12.1
Problem description:
The bundleMDX
function seems to doesn’t work in Vercel when it is in getServerSideProps
function from Next.js, but it actually works if it is in getStaticProps
.
Also both work in local, I don’t have errors at all on my local machine.
You can see see that currently it is a 500 error page : https://divlo-nlxbiy7k2-divlo.vercel.app/blog/hello-world
I saw that there was similar closed issue : #2
You can see the relevant code there : https://github.com/Divlo/Divlo/blob/feat/add-blog/pages/blog/[slug].tsx
Here is the log from the serverless function in Vercel :
ERROR Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/node_modules/periscopic/node_modules/estree-walker/dist/esm/estree-walker.js' imported from /var/task/node_modules/periscopic/src/index.js
Did you mean to import estree-walker/dist/umd/estree-walker.js?
at finalizeResolution (internal/modules/esm/resolve.js:276:11)
at moduleResolve (internal/modules/esm/resolve.js:699:10)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)
at Loader.resolve (internal/modules/esm/loader.js:86:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:56:40)
at link (internal/modules/esm/module_job.js:55:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Thanks for your help!
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Next.js getServerSideProps return undefined after deploy in ...
It works fine in dev mode but after deploy in vercel (re-deployed multiple times), the props I get from getServerSideProps() are undefined.
Read more >Data Fetching: getServerSideProps - Next.js
getServerSideProps returns JSON which will be used to render the page. All this work will be handled automatically by Next.js, so you don't...
Read more >SSR (getServerSideProps) not working on Prod : r/nextjs
I have nextjs app that fetches data from an API in the server-side at pages/index.tsx I have tried deploying this application on Vercel...
Read more >Next.js on Vercel – Vercel Docs
Vercel is the native Next.js platform, designed to enhance the Next.js ... By default, self-hosted ISR does not persist generated pages to durable...
Read more >getserversideprops not being called - You.com - You.com
Nextjs assumes it to be a component instead of a page, and getServerSideProps () only work inside pages instead of components. Also, getServerSideProps...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We can close this issue! Things work properly on the Vercel platform!
I did it with
npm
but the result is the same, Indeed it fixes the issue, thanks for your help! But yes forcing the installation of an npm package by editing manuallypackage-lock.json
, it is not great.So the issue will be definitely be fix once this issue will be closed : https://github.com/Rich-Harris/periscopic/issues/10