question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not work on Vercel inside getServerSideProps from Next.js

See original GitHub issue

Thanks for making this awesome npm package! 😄

  • mdx-bundler version: 4.0.0
  • node version: 14.16.1
  • npm 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:closed
  • Created 2 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Divlocommented, May 17, 2021

We can close this issue! Things work properly on the Vercel platform!

2reactions
Divlocommented, May 14, 2021

yarn has resolutions, maybe you could use that to force estree-walker@3 and see if that works.

I don’t use Next and I don’t if they’re doing any “post processing” on getServerSideProps

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 manually package-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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found