A Netlify Function failed to require one of its dependencies

My Netlify function has stopped the entire site from being deployed, seemingly out of nowhere because it was working well. While the site itself builds, this is what the log shows:

10:33:53 AM: build-image version: 0143b4617dd9b5b3faed2aefa29c54a846e69aae (focal)
10:33:53 AM: buildbot version: 24f7c9fcfdc0e642a0e84524831960fde1f386d1
10:33:53 AM: Building without cache
10:33:53 AM: Starting to prepare the repo for build
10:33:53 AM: No cached dependencies found. Cloning fresh repo
10:33:53 AM: git clone --filter=blob:none https://github.com/thedivtagguy/rhymer
10:33:53 AM: Preparing Git Reference refs/heads/refactor
10:33:54 AM: Custom functions path detected. Proceeding with the specified path: "netlify/my-functions"
10:33:55 AM: Starting to install dependencies
10:33:55 AM: Python version set to 3.8
10:33:55 AM: Attempting Ruby version 2.7.2, read from environment
10:33:56 AM: Using Ruby version 2.7.2
10:33:56 AM: Started restoring cached go cache
10:33:56 AM: Finished restoring cached go cache
10:33:57 AM: go version go1.19.13 linux/amd64
10:33:58 AM: Using PHP version 8.0
10:33:58 AM: v18.18.0 is already installed.
10:33:59 AM: Now using node v18.18.0 (npm v9.8.1)
10:33:59 AM: Enabling Node.js Corepack
10:33:59 AM: Started restoring cached build plugins
10:33:59 AM: Finished restoring cached build plugins
10:33:59 AM: Started restoring cached corepack dependencies
10:33:59 AM: Finished restoring cached corepack dependencies
10:33:59 AM: No pnpm workspaces detected
10:33:59 AM: Started restoring cached node modules
10:33:59 AM: Finished restoring cached node modules
10:33:59 AM: Installing npm packages using pnpm version 8.7.6
10:34:00 AM: Lockfile is up to date, resolution step is skipped
10:34:00 AM: Progress: resolved 1, reused 0, downloaded 0, added 0
10:34:00 AM: Packages: +369
10:34:00 AM: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10:34:01 AM: Progress: resolved 369, reused 0, downloaded 0, added 0
10:34:02 AM: Progress: resolved 369, reused 0, downloaded 135, added 135
10:34:03 AM: Progress: resolved 369, reused 0, downloaded 366, added 365
10:34:03 AM: Progress: resolved 369, reused 0, downloaded 369, added 369, done
10:34:03 AM:  WARN  Failed to create bin at /opt/build/repo/node_modules/.pnpm/supabase@1.100.1/node_modules/supabase/node_modules/.bin/supabase. ENOENT: no such file or directory, open "/opt/build/repo/node_modules/.pnpm/supabase@1.100.1/node_modules/supabase/bin/supabase"
10:34:03 AM: .../es5-ext@0.10.62/node_modules/es5-ext postinstall$  node -e "try{require("./_postinstall")}catch(e){}" || exit 0
10:34:03 AM: .../node_modules/supabase postinstall$ node scripts/postinstall.js
10:34:03 AM: .../es5-ext@0.10.62/node_modules/es5-ext postinstall: Done
10:34:03 AM: .../node_modules/bufferutil install$ node-gyp-build
10:34:03 AM: .../node_modules/utf-8-validate install$ node-gyp-build
10:34:03 AM: .../node_modules/svelte-preprocess postinstall$ echo "[svelte-preprocess] Don"t forget to install the preprocessors packages that will be used: sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc..."
10:34:04 AM: .../node_modules/supabase postinstall: Downloading https://github.com/supabase/cli/releases/download/v1.100.1/supabase_linux_amd64.tar.gz
10:34:04 AM: .../node_modules/svelte-preprocess postinstall: [svelte-preprocess] Don"t forget to install the preprocessors packages that will be used: sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc...
.../node_modules/svelte-preprocess postinstall: Done
10:34:04 AM: .../node_modules/bufferutil install: Done
10:34:04 AM: .../node_modules/utf-8-validate install: Done
10:34:04 AM: .../node_modules/supabase postinstall: Downloading https://github.com/supabase/cli/releases/download/v1.100.1/supabase_1.100.1_checksums.txt
10:34:04 AM: .../node_modules/supabase postinstall: Checksum verified.
10:34:04 AM: .../node_modules/supabase postinstall: Installed Supabase CLI successfully
10:34:04 AM: .../node_modules/supabase postinstall: Done
10:34:04 AM: .../esbuild@0.18.20/node_modules/esbuild postinstall$ node install.js
10:34:04 AM: .../esbuild@0.19.4/node_modules/esbuild postinstall$ node install.js
10:34:04 AM: .../node_modules/workerd postinstall$ node install.js
10:34:04 AM: .../esbuild@0.18.20/node_modules/esbuild postinstall: Done
10:34:04 AM: .../esbuild@0.19.4/node_modules/esbuild postinstall: Done
10:34:04 AM: .../node_modules/msgpackr-extract install$ node-gyp-build-optional-packages
10:34:04 AM: .../node_modules/workerd postinstall: Done
10:34:04 AM: .../node_modules/msgpackr-extract install: Done
10:34:05 AM: .../node_modules/@sveltejs/kit postinstall$ node postinstall.js
10:34:05 AM: .../node_modules/@sveltejs/kit postinstall: Done
10:34:06 AM: dependencies:
10:34:06 AM: + @fontsource-variable/nunito 5.0.9
10:34:06 AM: + @fontsource-variable/nunito-sans 5.0.9
10:34:06 AM: + axios 1.5.1
10:34:06 AM: + colyseus 0.15.9
10:34:06 AM: + partysocket 0.0.8
10:34:06 AM: + short-unique-id 5.0.3
10:34:06 AM: + svelte-keyboard 0.5.5
10:34:06 AM: devDependencies:
10:34:06 AM: + @fontsource/fira-mono 4.5.10
10:34:06 AM: + @melt-ui/pp 0.1.2
10:34:06 AM: + @melt-ui/svelte 0.52.0
10:34:06 AM: + @neoconfetti/svelte 1.0.0
10:34:06 AM: + @supabase/functions-js 2.1.5
10:34:06 AM: + @supabase/gotrue-js 2.55.0
10:34:06 AM: + @supabase/node-fetch 2.6.13
10:34:06 AM: + @supabase/postgrest-js 1.8.4
10:34:06 AM: + @supabase/realtime-js 2.8.0
10:34:06 AM: + @supabase/storage-js 2.5.4
10:34:06 AM: + @supabase/supabase-js 2.38.0
10:34:06 AM: + @sveltejs/adapter-auto 2.0.0
10:34:06 AM: + @sveltejs/adapter-static 2.0.3
10:34:06 AM: + @sveltejs/kit 1.20.4
10:34:06 AM: + @types/cookie 0.5.1
10:34:06 AM: + bufferutil 4.0.7
10:34:06 AM: + eslint 8.28.0
10:34:06 AM: + eslint-config-prettier 8.5.0
10:34:06 AM: + eslint-plugin-svelte 2.30.0
10:34:06 AM: + fractils 3.1.2
10:34:06 AM: + lucide-svelte 0.284.0
10:34:06 AM: + partykit 0.0.26
10:34:06 AM: + prettier 2.8.0
10:34:06 AM: + prettier-plugin-svelte 2.10.1
10:34:06 AM: + supabase 1.100.1
10:34:06 AM: + svelte 4.0.5
10:34:06 AM: + svelte-check 3.4.3
10:34:06 AM: + svelte-confetti 1.3.1
10:34:06 AM: + svelte-legos 0.2.2
10:34:06 AM: + svelte-sequential-preprocessor 2.0.1
10:34:06 AM: + typescript 5.0.2
10:34:06 AM: + vite 4.4.2
10:34:06 AM: Done in 6.4s
10:34:06 AM: npm packages installed using pnpm
10:34:07 AM: Install dependencies script success
10:34:07 AM: Starting build script
10:34:07 AM: Detected 1 framework(s)
10:34:07 AM: "svelte-kit" at version "1.20.4"
10:34:07 AM: Section completed: initializing
10:34:09 AM: Netlify Build                                                 
10:34:09 AM: ────────────────────────────────────────────────────────────────
10:34:09 AM: ​
10:34:09 AM: ❯ Version
10:34:09 AM:   @netlify/build 29.21.1
10:34:09 AM: ​
10:34:09 AM: ❯ Flags
10:34:09 AM:   baseRelDir: true
10:34:09 AM:   buildId: 652238291c0751765262e421
10:34:09 AM:   deployId: 652238291c0751765262e423
10:34:09 AM: ​
10:34:09 AM: ❯ Current directory
10:34:09 AM:   /opt/build/repo
10:34:09 AM: ​
10:34:09 AM: ❯ Config file
10:34:09 AM:   /opt/build/repo/netlify.toml
10:34:09 AM: ​
10:34:09 AM: ❯ Context
10:34:09 AM:   branch-deploy
10:34:09 AM: ​
10:34:09 AM: Build command from Netlify app                                
10:34:09 AM: ────────────────────────────────────────────────────────────────
10:34:09 AM: ​
10:34:09 AM: $ npm run build
10:34:09 AM: > rhymer@0.0.1 build
10:34:09 AM: > vite build
10:34:10 AM: vite v4.4.2 building SSR bundle for production...
10:34:10 AM: transforming...
10:34:10 AM: 5:04:10 AM [vite-plugin-svelte] /opt/build/repo/src/components/GameLogic.svelte:157:19 "isGameFinish" is not defined
10:34:10 AM: 155:       <p>Wait for others to join!</p>
10:34:10 AM: 156:     {:else if gameFinished}
10:34:10 AM: 157:       <Dialog isOpen={isGameFinish}>
10:34:10 AM:                            ^
10:34:10 AM: 158:         <!-- For fields slot -->
10:34:10 AM: 159:         <div slot="fields">
10:34:10 AM: 5:04:10 AM [vite-plugin-svelte] /opt/build/repo/src/components/GameLogic.svelte:410:1 Unused CSS selector "button.primary"
10:34:10 AM: 408:   }
10:34:10 AM: 409:
10:34:10 AM: 410:   button.primary {
10:34:10 AM:        ^
10:34:10 AM: 411:     display: inline-flex;
10:34:10 AM: 412:     align-items: center;
10:34:15 AM: βœ“ 1688 modules transformed.
10:34:15 AM: rendering chunks...
10:34:15 AM: vite v4.4.2 building for production...
10:34:15 AM: transforming...
10:34:16 AM: 5:04:16 AM [vite-plugin-svelte] /opt/build/repo/src/components/GameLogic.svelte:157:19 "isGameFinish" is not defined
10:34:16 AM: 155:       <p>Wait for others to join!</p>
10:34:16 AM: 156:     {:else if gameFinished}
10:34:16 AM: 157:       <Dialog isOpen={isGameFinish}>
10:34:16 AM:                            ^
10:34:16 AM: 158:         <!-- For fields slot -->
10:34:16 AM: 159:         <div slot="fields">
10:34:16 AM: 5:04:16 AM [vite-plugin-svelte] /opt/build/repo/src/components/GameLogic.svelte:410:1 Unused CSS selector "button.primary"
10:34:16 AM: 408:   }
10:34:16 AM: 409:
10:34:16 AM: 410:   button.primary {
10:34:16 AM:        ^
10:34:16 AM: 411:     display: inline-flex;
10:34:16 AM: 412:     align-items: center;
10:34:25 AM: βœ“ 1675 modules transformed.
10:34:25 AM: rendering chunks...
10:34:25 AM: computing gzip size...
10:34:25 AM: .svelte-kit/output/client/_app/version.json                                                        0.03 kB β”‚ gzip:  0.05 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/info.67485b8b.svg                                  0.47 kB β”‚ gzip:  0.26 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/cross.42442b15.svg                                 0.57 kB β”‚ gzip:  0.37 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/success.e8e52ddb.svg                               0.93 kB β”‚ gzip:  0.47 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/error.30b3866a.svg                                 1.05 kB β”‚ gzip:  0.46 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/warn.52ac6d02.svg                                  1.32 kB β”‚ gzip:  0.69 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/fira-mono-greek-ext-400-normal.9e2fe623.woff2      7.51 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/fira-mono-cyrillic-400-normal.c7d433fd.woff2       9.10 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/fira-mono-greek-400-normal.a8be01ce.woff2         10.52 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/nunito-vietnamese-wght-normal.0ef9726d.woff2      10.63 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/fira-mono-latin-ext-400-normal.6bfabd30.woff2     11.36 kB
10:34:25 AM: .svelte-kit/output/client/vite-manifest.json                                                      11.90 kB β”‚ gzip:  1.34 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/fira-mono-cyrillic-ext-400-normal.3df7909e.woff2  15.77 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/fira-mono-latin-400-normal.e43b3538.woff2         16.28 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/nunito-cyrillic-wght-normal.7ca4b4bb.woff2        20.82 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/nunito-cyrillic-ext-wght-normal.b2611fa3.woff2    28.96 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/nunito-latin-ext-wght-normal.89def742.woff2       32.72 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/nunito-latin-wght-normal.96217f1d.woff2           35.90 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/fira-mono-all-400-normal.1e3b098c.woff            77.36 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/PeoplePresence.68246fc6.css                        0.28 kB β”‚ gzip:  0.20 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/stores.91c5c161.css                                0.67 kB β”‚ gzip:  0.40 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/2.137dc43e.css                                     1.41 kB β”‚ gzip:  0.52 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/3.5f37ebd3.css                                     8.91 kB β”‚ gzip:  2.40 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/assets/0.f75910b6.css                                     9.68 kB β”‚ gzip:  2.62 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/stores.8d5a34dd.js                                 0.24 kB β”‚ gzip:  0.17 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/nodes/1.6f537d05.js                                       0.84 kB β”‚ gzip:  0.52 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/index.8bb81525.js                                  1.00 kB β”‚ gzip:  0.60 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/stores.3ab0c68c.js                                 1.32 kB β”‚ gzip:  0.69 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/singletons.158cff40.js                             2.46 kB β”‚ gzip:  1.26 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/PeoplePresence.94de71f1.js                         3.55 kB β”‚ gzip:  1.62 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/index.bfd665c5.js                                  5.63 kB β”‚ gzip:  2.76 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/entry/app.a1472f6e.js                                     6.74 kB β”‚ gzip:  2.48 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/scheduler.c8c2b7c4.js                              8.74 kB β”‚ gzip:  3.48 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/short-unique-id.bec4e7ab.js                        8.99 kB β”‚ gzip:  3.07 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/nodes/0.585cb583.js                                      13.51 kB β”‚ gzip:  5.37 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/nodes/2.c0443c72.js                                      22.06 kB β”‚ gzip:  8.78 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/entry/start.d873f4a4.js                                  23.98 kB β”‚ gzip:  9.51 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/chunks/GuessMarker.847c8ada.js                           28.17 kB β”‚ gzip: 10.41 kB
10:34:25 AM: .svelte-kit/output/client/_app/immutable/nodes/3.bb666f9c.js                                      46.31 kB β”‚ gzip: 14.63 kB
10:34:25 AM: βœ“ built in 10.08s
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/info.67485b8b.svg                                   0.47 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/cross.42442b15.svg                                  0.57 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/success.e8e52ddb.svg                                0.93 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/error.30b3866a.svg                                  1.05 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/warn.52ac6d02.svg                                   1.32 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/fira-mono-greek-ext-400-normal.9e2fe623.woff2       7.51 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/fira-mono-cyrillic-400-normal.c7d433fd.woff2        9.10 kB
10:34:26 AM: .svelte-kit/output/server/vite-manifest.json                                                       10.13 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/fira-mono-greek-400-normal.a8be01ce.woff2          10.52 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/nunito-vietnamese-wght-normal.0ef9726d.woff2       10.63 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/fira-mono-latin-ext-400-normal.6bfabd30.woff2      11.36 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/fira-mono-cyrillic-ext-400-normal.3df7909e.woff2   15.77 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/fira-mono-latin-400-normal.e43b3538.woff2          16.28 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/nunito-cyrillic-wght-normal.7ca4b4bb.woff2         20.82 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/nunito-cyrillic-ext-wght-normal.b2611fa3.woff2     28.96 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/nunito-latin-ext-wght-normal.89def742.woff2        32.72 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/nunito-latin-wght-normal.96217f1d.woff2            35.90 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/fira-mono-all-400-normal.1e3b098c.woff             77.36 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/PeoplePresence.68246fc6.css                         0.28 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/stores.8e3dae57.css                                 0.65 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/_page.137dc43e.css                                  1.41 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/_page.97e12765.css                                  8.82 kB
10:34:26 AM: .svelte-kit/output/server/_app/immutable/assets/_layout.96daddf0.css                               10.02 kB
10:34:26 AM: .svelte-kit/output/server/entries/pages/_page.js                                                    0.05 kB
10:34:26 AM: .svelte-kit/output/server/entries/pages/battle/_page.js                                             0.05 kB
10:34:26 AM: .svelte-kit/output/server/internal.js                                                               0.19 kB
10:34:26 AM: .svelte-kit/output/server/entries/fallbacks/error.svelte.js                                         0.89 kB
10:34:26 AM: .svelte-kit/output/server/chunks/stores.js                                                          2.30 kB
10:34:26 AM: .svelte-kit/output/server/entries/pages/battle/_page.svelte.js                                      2.61 kB
10:34:26 AM: .svelte-kit/output/server/chunks/index.js                                                           2.68 kB
10:34:26 AM: .svelte-kit/output/server/chunks/action.js                                                          5.18 kB
10:34:26 AM: .svelte-kit/output/server/chunks/internal.js                                                        5.37 kB
10:34:26 AM: .svelte-kit/output/server/chunks/ssr.js                                                             8.46 kB
10:34:26 AM: .svelte-kit/output/server/entries/pages/_page.svelte.js                                            19.52 kB
10:34:26 AM: .svelte-kit/output/server/entries/pages/_layout.svelte.js                                          77.44 kB
10:34:26 AM: .svelte-kit/output/server/index.js                                                                106.89 kB
10:34:26 AM: Run npm run preview to preview your production build locally.
10:34:26 AM: 
10:34:26 AM: > Using @sveltejs/adapter-static
10:34:26 AM:   Wrote site to "build"
10:34:26 AM:   βœ” done
10:34:26 AM: βœ“ built in 15.67s
10:34:26 AM: ​
10:34:26 AM: (build.command completed in 16.8s)
10:34:26 AM: ​
10:34:26 AM: Functions bundling                                            
10:34:26 AM: ────────────────────────────────────────────────────────────────
10:34:26 AM: ​
10:34:26 AM: Packaging Functions from netlify/my-functions directory:
10:34:26 AM:  - create-room/create-room.cjs
10:34:26 AM: ​
10:34:26 AM: ​
10:34:26 AM: Dependencies installation error                               
10:34:26 AM: ────────────────────────────────────────────────────────────────
10:34:26 AM: ​
10:34:26 AM:   Error message
10:34:26 AM:   A Netlify Function failed to require one of its dependencies.
10:34:26 AM:   Please make sure it is present in the site"s top-level "package.json".
​
10:34:26 AM:   In file "/opt/build/repo/netlify/my-functions/create-room/create-room.cjs"
10:34:26 AM:   Cannot find module "whatwg-url"
10:34:26 AM:   Require stack:
10:34:26 AM:   - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js
10:34:26 AM: ​
10:34:26 AM:   Resolved config
10:34:26 AM:   build:
10:34:26 AM:     command: npm run build
10:34:26 AM:     commandOrigin: ui
10:34:26 AM:     environment:
10:34:26 AM:       - SUPABASE_ACCESS_TOKEN
10:34:26 AM:       - SUPABASE_API_KEY
10:34:26 AM:       - SUPABASE_URL
10:34:26 AM:     publish: /opt/build/repo/build
10:34:26 AM:     publishOrigin: ui
10:34:26 AM:   functionsDirectory: /opt/build/repo/netlify/my-functions
10:34:27 AM: Failed during stage "building site": Build script returned non-zero exit code: 2
10:34:27 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:34:27 AM: Failing build: Failed to build site
10:34:28 AM: Finished processing build request in 34.929s

I have:

  1. Cleared cache and tried to deploy again multiple times.
  2. Deleted pnpm-lock.yaml and regenerated it and then pushed the newest one.
  3. Tried to manually include the dependencies that the log tells me are not found, but this is endless. It didn’t happen before.
  4. Deleted the netlify functions folder (and even renamed it), and created fresh files and folders.
  5. The function has a single external package and I’ve included that in package.json.

Why has this stopped working all of a sudden and what can I do to fix it? I can’t find anything on the support forum that helps understand what is going wrong either.

Github Repo: GitHub - thedivtagguy/rhymer at refactor
Deploy URL: Netlify App
Deploy ID: 652238291c0751765262e423
Last Successful Deploy: https://65212af96a3be60008226b3b--rhymer.netlify.app/

Sounds like something went wrong on our end. While we investigate, can you try adding whatwg-url to your package.json to see if it makes a difference?

On another thought, since you’re using pnpm, have you checked: Next.js on Netlify | Netlify Docs? While it’s mainly for Next.js, sometimes also applies to other functions.

I can, but I’ve done the same thing for the 5 other package errors it threw up before. I reckon I’ll have to go through all dependencies this way then.

Also pnpm was working initially! I’ve provided the last successful deploy from my setup. This has happened out of nowhere.

8:37:47 PM: ────────────────────────────────────────────────────────────────
8:37:47 PM: ​
8:37:47 PM: Packaging Functions from netlify/my-functions directory:
8:37:47 PM:  - create-room/create-room.cjs
8:37:47 PM: ​
8:37:48 PM: ​
8:37:48 PM: Dependencies installation error                               
8:37:48 PM: ────────────────────────────────────────────────────────────────
8:37:48 PM: ​
8:37:48 PM:   Error message
8:37:48 PM:   A Netlify Function failed to require one of its dependencies.
8:37:48 PM:   Please make sure it is present in the site"s top-level "package.json".
​
8:37:48 PM:   In file "/opt/build/repo/netlify/my-functions/create-room/create-room.cjs"
8:37:48 PM:   Cannot find module "websocket"
8:37:48 PM:   Require stack:
8:37:48 PM:   - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js
8:37:48 PM: ​
8:37:48 PM:   Resolved config
8:37:48 PM:   build:
8:37:48 PM:     command: npm run build

Yep, I think this will keep going on! Just did that and ran build again.

What happens if you specify:

[functions]
  node_bundler = "zisi"

(or esbuild) in netlify.toml?

Zisi:

12:27:17 AM: Dependencies installation error                               
12:27:17 AM: ────────────────────────────────────────────────────────────────
12:27:17 AM: ​
12:27:17 AM:   Error message
12:27:17 AM:   A Netlify Function failed to require one of its dependencies.
12:27:17 AM:   Please make sure it is present in the site"s top-level "package.json".
​
12:27:17 AM:   In file "/opt/build/repo/netlify/my-functions/create-room/create-room.cjs"
12:27:17 AM:   Cannot find module "websocket"
12:27:17 AM:   Require stack:
12:27:17 AM:   - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js
12:27:17 AM: ​
12:27:17 AM:   Resolved config
12:27:17 AM:   build:
12:27:17 AM:     command: npm run build
12:27:17 AM:     commandOrigin: ui
12:27:17 AM:     environment:
12:27:17 AM:       - SUPABASE_ACCESS_TOKEN
12:27:17 AM:       - SUPABASE_API_KEY
12:27:17 AM:       - SUPABASE_URL
12:27:17 AM:     publish: /opt/build/repo/build
12:27:17 AM:     publishOrigin: ui
12:27:17 AM:   functions:
12:27:17 AM:     "*":
12:27:17 AM:       node_bundler: zisi
12:27:17 AM:   functionsDirectory: /opt/build/repo/netlify/my-functions
12:27:17 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:27:18 AM: Failing build: Failed to build site

esbuild does build the website but doesn’t seem to work completely. You can see this for yourself by going to this link, clicking β€˜get a room’, choosing and option and clicking β€˜get room’. The console should throw this error:

Error creating room: 
Object { errorType: "Runtime.ImportModuleError", errorMessage: "Error: Cannot find module 'bufferutil'\nRequire stack:\n- /var/task/netlify/my-functions/create-room/create-room.js\n- /var/task/create-room.js\n- /var/runtime/index.mjs", trace: (9) […] }
​
errorMessage: "Error: Cannot find module 'bufferutil'\nRequire stack:\n- /var/task/netlify/my-functions/create-room/create-room.js\n- /var/task/create-room.js\n- /var/runtime/index.mjs"
​
errorType: "Runtime.ImportModuleError"
​
trace: Array(9) [ "Runtime.ImportModuleError: Error: Cannot find module 'bufferutil'", "Require stack:", "- /var/task/netlify/my-functions/create-room/create-room.js", … ]
​​
0: "Runtime.ImportModuleError: Error: Cannot find module 'bufferutil'"
​​
1: "Require stack:"
​​
2: "- /var/task/netlify/my-functions/create-room/create-room.js"
​​
3: "- /var/task/create-room.js"
​​
4: "- /var/runtime/index.mjs"
​​
5: "    at _loadUserApp (file:///var/runtime/index.mjs:1061:17)"
​​
6: "    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1093:21)"
​​
7: "    at async start (file:///var/runtime/index.mjs:1256:23)"
​​
8: "    at async file:///var/runtime/index.mjs:1262:1"
​​
length: 9
​​
<prototype>: Array []
​
<prototype>: Object { … }

What β€˜create room’ does is send a POST request to supabase. This error of bufferutil not found is the same dependency error I got. You can see I’ve even included it in my package.json

Now that my folder is called netlify/my-functions, would this also change to reflect that name?

const host = isDevMode
		? 'localhost:33141/.netlify/my-functions/create-room'
		: '/.netlify/my-functions/create-room';

For production as well?

Edit: I don’t think this seems to work either.

I have asked the devs to check the issue about the function bundling. About your last message, I’m not sure what you’re trying to do or ask. Could you try rephrasing?

I was asking about the url to use to reach the POST endpoint in production. Earlier, I was using ./netlify/functions/<my_function> in my client code to send the POST request to. Since I had changed the folder name to my-functions, would that URL have to be changed too, or is /.netlify/functions standard?

Anything I can do in the meantime? This has halted development.

Hey there! Sorry for this bug. It seems to be related to PNPM and the node_modules structure that it generates.

For some background: PNPM generates a very complex folder structure into node_modules that makes heavy use of symlinks, and is highly nested. We believe there’s a bug within our default bundler that doesn’t correctly pick up websocket in this case. We’re working on finding the cause.

In the meantime, you can try one of these two things to work around the issue:

  1. Switch from pnpm to npm or yarn. They should be working fine.
  2. Set the node_bundler to nft. This alternative bundling strategy should correctly be handling PNPM.

Let me know if that works for you.

1 Like

Hey @skn0tt, thank you for your help!

Setting the bundler to nft works and solves the build error right now. I also appreciate the prompt response.

Also note that the problem isn’t specifically with websocket, as this was the 5th dependency error I got, and the bundler doesn’t seem to be picking up on any of the other ones either.

Let me know if I should mark this as the solution or leave it be for now, till this is properly fixed.

1 Like

Good to hear nft fixes the error!

Let me know if I should mark this as the solution or leave it be for now, till this is properly fixed.

Leave it be for now - we’re working on a fix for this.

1 Like