CLOUDFLARE WORKERS NOT WORKING!!! - URGENT!!!

I was trying to deploy our website to Cloudflare Workers, why is it not working? Here is the error code:
X [ERROR] Build failed with 1 error:

X [ERROR] Could not resolve "@mongodb-js/saslprep"


.worker-next/.next/standalone/node_modules/mongoose/node_modules/mongodb/lib/cmap/auth/scram.js:4:27:
4 │ const saslprep_1 = require("@mongodb-js/saslprep");
╵ ~~~~

The module "./dist/browser.js" was not found on the file system:

.worker-next/.next/standalone/node_modules/@mongodb-js/saslprep/package.json:33:17:
33 │ "default": "./dist/browser.js"
╵ ~~~~~

You can mark the path "@mongodb-js/saslprep" as external to exclude it from the bundle, which
will remove this error. You can also surround this "require" call with a try/catch block to handle
this failure at run-time instead of bundle-time.
X [ERROR] Build failed with 1 error:

X [ERROR] Could not resolve "@mongodb-js/saslprep"


.worker-next/.next/standalone/node_modules/mongoose/node_modules/mongodb/lib/cmap/auth/scram.js:4:27:
4 │ const saslprep_1 = require("@mongodb-js/saslprep");
╵ ~~~~

The module "./dist/browser.js" was not found on the file system:

.worker-next/.next/standalone/node_modules/@mongodb-js/saslprep/package.json:33:17:
33 │ "default": "./dist/browser.js"
╵ ~~~~~

You can mark the path "@mongodb-js/saslprep" as external to exclude it from the bundle, which
will remove this error. You can also surround this "require" call with a try/catch block to handle
this failure at run-time instead of bundle-time.
1 Reply
I'm forever offline now
I found the error at the end, it’s not because of MongoDB,but it’s because I enabled some parameter of ARM something in CloudFlare. It’s fine, we will keep using Amplify, Cloudlfare Workers just doesn’t support MongoDB, hope they could support them in future. Really like this company for its amazing service- we are using their DNS

Did you find this page helpful?