Error with SWR when deploying Next.js to Netlify

Hi all,

I’m having a problem with deployment on Netlify. I’m trying to deploy a branch that uses useSWR. In the first deployment, it built and worked as expected. However, in the builds that followed, it started to crash. Even when retriggering the original build that worked, it now crashes.

The error that I’m specifically getting is the following:

I’m unable to replicate the error locally, and I have no clue why this is happening. Here’s some information about my project;

  • Next.js 12.0.10
  • React/React-DOM 17.0.2
  • SWR 1.2.1

If you can provide any help, I would really appreciate it. I can also provide any other necessary information needed.


Hey there, @p0w3r_zurg3 :wave:

Thanks for reaching out! Can you share your full deploy log as well as your package.json?

Hi Hillary!

I came across this post, which seems to have solved it.

Adding the following text to netlify.toml did the trick for me as well;



1 Like

Hey there, @p0w3r_zurg3

Glad to hear everything is working now! Thanks for letting us know. Happy building :netliconfetti: