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.

Netlify briefly broke esbuild builds, causing "Dynamic require of "X"" errors for every serverless rendered page [fixed]

See original GitHub issue

Describe the bug

as part of regular maintenance for swyxkit i upgraded the deps as per the title

and now everything is throwing a 500 error with this Dynamic require of "fs" error, even though i’m pretty darn sure I don’t actually write that code. EDIT: Possible related error: https://github.com/sveltejs/kit/issues/2400

this error only happens in prod build, not in local dev. is this something broken in the netlify adapter?

Feb 23, 07:43:09 PM: 24d25a60 ERROR  Error: Dynamic require of "fs" is not supported
Feb 23, 07:43:09 PM: 24d25a60     at __require (file:///var/task/.netlify/functions-internal/render.js:28:9)
Feb 23, 07:43:09 PM: 24d25a60     at node_modules/gray-matter/index.js (file:///var/task/.netlify/functions-internal/render.js:10725:14)
Feb 23, 07:43:09 PM: 24d25a60     at __require2 (file:///var/task/.netlify/functions-internal/render.js:34:44)
Feb 23, 07:43:09 PM: 24d25a60     at .netlify/server/chunks/content-4d53413a.js (file:///var/task/.netlify/functions-internal/render.js:17141:37)
Feb 23, 07:43:09 PM: 24d25a60     at __init (file:///var/task/.netlify/functions-internal/render.js:31:50)
Feb 23, 07:43:09 PM: 24d25a60     at .netlify/server/entries/endpoints/api/listContent.json.js (file:///var/task/.netlify/functions-internal/render.js:17185:5)
Feb 23, 07:43:09 PM: 24d25a60     at __init (file:///var/task/.netlify/functions-internal/render.js:31:50)
Feb 23, 07:43:09 PM: 24d25a60     at file:///var/task/.netlify/functions-internal/render.js:26540:51
Feb 23, 07:43:09 PM: 24d25a60     at async resolve (file:///var/task/.netlify/functions-internal/render.js:26295:83)
Feb 23, 07:43:09 PM: 24d25a60     at async respond (file:///var/task/.netlify/functions-internal/render.js:26246:22)

image

Reproduction

this is the netlify build logs https://app.netlify.com/sites/swyxkit/deploys/621638d27781070008fb992c

and this is the commit https://github.com/sw-yx/swyxkit/tree/c452df95219f73c4c3cd199490752656f0ab89ec

Logs

No response

System Info

System:
    OS: macOS 11.3.1
    CPU: (8) x64 Apple M1
    Memory: 38.87 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.11.1 - /var/folders/h_/1lq46tdj7jdbs0j1m5l6rlb00000gn/T/fnm_multishell_23513_1645623105494/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.0.0 - /var/folders/h_/1lq46tdj7jdbs0j1m5l6rlb00000gn/T/fnm_multishell_23513_1645623105494/bin/npm
  Browsers:
    Chrome: 98.0.4758.102
    Firefox: 94.0.2
    Safari: 14.1
  npmPackages:
    @sveltejs/adapter-netlify: ^1.0.0-next.46 => 1.0.0-next.46 
    @sveltejs/kit: ^1.0.0-next.283 => 1.0.0-next.283 
    svelte: ^3.44.3 => 3.46.4

Severity

blocking an upgrade

Additional Information

still trying to narrow down the precise version where this broke

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
PH4NTOMikicommented, Feb 25, 2022
2reactions
sw-yxcommented, Feb 25, 2022

WOW so it was not my/our fault?!? amazing. thank you so much, will retry.

edit: confirmed that a simple rebuild fixed it, now that Netlify reverted their change. watch https://github.com/netlify/zip-it-and-ship-it/issues/1036 for when they try it again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Netlify Serverless Typescript functions fail with dynamic requires
Typescript serverless functions seem to be failing for me with {"errorType":"Error","errorMessage":"Dynamic require of \"util\" is not supported" ...
Read more >
fr2.rpmfind.net/linux/opensuse/tumbleweed/repo/oss...
+ Fix network process crash when fetching website data on ephemeral session. + Fix the build with Ruby 3.2. + Fix several crashes...
Read more >
464: Jamstack & New Netlify Features with Jason Lengstorf ...
Jason Lengstorf and Phil Hawksworth chat about the current state of the Jamstack including React + Jamstack, Distributed Persistent ...
Read more >
Simple index - piwheels
... holodex hardlyjson adafruit-circuitpython-wsgi ftpackage ringo-tag mondriaan nctevn rqrcode pycsvy django-simple-error pyriksprot-tagger tle2czml modpy ...
Read more >
Download Diff File
That would be helpful to locate the problem and save us each other's time ... + +During build, we create a server-rendered version...
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