Serverless function stopped working, no code change

The search on my site has stopped working. It is run by a serverless function. It used to run fine, but I can show that with no code changes on my end, it no longer works. (though underlying dependencies may have minor version differences).

Site name: pr-blog-37e418
Search form can be found here: Blog - Philip Renich or Blog - Philip Renich
Example serverless function URL: https://www.philiprenich.com/search/?s=term

If you go back to an old deploy preview, you’ll find it functioning correctly:

I’ve created a branch from the PR that commit is from and deployed it

The Netlify internal ID: 01HBQG8V8N9EN5C9N7X5VPKQDF

That PR/commit that I’ve tested with is from January, but I’m 99% sure this was working on more recent deployments until fairly recently (perhaps within the last month?). I don’t think there are any problems in NPM dependencies based on the error messages. The Eleventy Serverless Plugin I’m using for this has not had any major changes that I can tell in at least 9 months, if not longer.

I know of at least 1 other 11ty user experiencing this issue, so I’ll point them to this topic in case that helps hone in on a commonality.

Thanks!

Hi @mez,

Thanks for reaching out!

I’m seeing this error in the function logs:

ERROR Invoke Error {"errorType":"Error","errorMessage":"Cannot find module '/var/task/netlify/functions/search/eleventy-serverless-map.json'\nRequire stack:\n- /var/task/node_modules/@11ty/eleventy/src/Serverless.js\n- /var/task/node_modules/@11ty/eleventy/src/Eleventy.js\n- /var/task/netlify/functions/search/index.js\n- /var/task/search.js\n- /var/runtime/index.mjs","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@11ty/eleventy/src/Serverless.js","/var/task/node_modules/@11ty/eleventy/src/Eleventy.js","/var/task/netlify/functions/search/index.js","/var/task/search.js","/var/runtime/index.mjs"],"stack":["Error: Cannot find module '/var/task/netlify/functions/search/eleventy-serverless-map.json'","Require stack:","- /var/task/node_modules/@11ty/eleventy/src/Serverless.js","- /var/task/node_modules/@11ty/eleventy/src/Eleventy.js","- /var/task/netlify/functions/search/index.js","- /var/task/search.js","- /var/runtime/index.mjs"," at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)"," at Module._load (node:internal/modules/cjs/loader:922:27)"," at Module.require (node:internal/modules/cjs/loader:1143:19)"," at require (node:internal/modules/cjs/helpers:121:18)"," at Serverless.getContentMap (/var/task/node_modules/@11ty/eleventy/src/Serverless.js:105:12)"," at Serverless.isServerlessUrl (/var/task/node_modules/@11ty/eleventy/src/Serverless.js:119:27)"," at Runtime.handler (/var/task/netlify/functions/search/index.js:34:14)"]}

This error indicates that there’s the module eleventy-serverless-map.json can’t be found.

You’ll want to verify that the file eleventy-serverless-map.json exist at the path. You can also check the code and see where the import of eleventy-serverless-map.json is trying to take place and if the import is correct and matches the file path.

I also found this issue, there’s a solution posted that may help you resolve the problem.

I also had this issue. I found adding the following to netlify.toml fixed the issue.

[functions]
node_bundler = "zisi"

I had zero code changes, and the builds started breaking on their own from a data webhook. I believe there must me some change Netlify has made which has caused this, surely?

2 Likes

@Melvin FYI I had this same issue, relating to a file in a sibling monorepo package.

I also fixed it with not just zisi but also having to rename files and recommit to git, etc.

Local builds were working fine, and even pushing local builds to netlify via CLI worked fine.

I didn’t love having to troubleshoot our whole build system over a tiny code change I pushed while on vacation (due to a different crisis… :man_facepalming:t2:)… Any reason these files stopped getting bundled?

Here’s the first deploy that failed:
651afe63cf1e1a0008ec9f3a

Adding the (supposedly default) node_bundler = "zisi" key-value to my netlify.toml file solved it. No other code changes.

@Melvin I can’t see how this isn’t a change in the Netlify codebase / infrastructure causing this. Thanks for looking in to it!

About a month ago, we started a phased rollout of changing the default bundler which may have caused this. I’ve let the devs know that that’s causing some unexpected results, but if someone has a reproduction repo they can share, that would be a bonus.

The rollout has been paused, so folks should not be seeing this issue anymore.