Is there any edge sub-dependency problem work-around?

I have been using Cloudflare Pages for my deployments, sometimes Vercel depending on the project, but I haven't self-hosted anything for a while now. For my current Nuxt project, I rely on MongoDB as a database, but MongoDB doesn't seem to be Edge-compatible due to some dependencies. Deployments are therefore not running on Edge, but I would hate to develop the project without Cloudflare Pages. Apart from small projects like https://github.com/drivly/mongo-fetch, are there any other workarounds to deal with such problems? At MongoDB I have already tipped in Edge support as a feature request, but so far this has met with little interest. I'm not really familiar with all this Edge stuff, occasionally Node.js features caused problems, but that works quite well now and these stress-free deployments with previews directly from GitHub were an absolute luxury compared to my AWS EC2 instances before... Maybe there is some kind of solution and I just don't know it, at least I hope so 😅
2 Replies
nico
nicoOP•10mo ago
Here is the error. It is caused by "@aws-sdk/credential-providers" which is a sub-dependency of the MongoDB driver for Node apps and I havent found a work-around or any alternative way to bring my deployments back to work while still using MongoDB in my Nuxt app
23:06:37.720 [info] [nitro] Building Nitro Server (preset: `cloudflare-pages`)
23:06:39.180 Connected to MongoDB
23:06:58.639 [error] [nitro] Error: Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/deps.js" and externals are not allowed!
23:06:58.640
23:06:58.640
23:06:58.640 undefined
23:06:58.642 [error] Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/deps.js" and externals are not allowed!
23:06:58.642 at Object.resolveId (node_modules/.pnpm/[email protected]/node_modules/nitropack/dist/shared/nitro.4ea992bc.mjs:1973:17)
23:06:58.642 at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18592:28)
23:06:58.643 at async resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17261:26)
23:06:58.643 at async ModuleLoader.resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17675:15)
23:06:58.643 at async node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:785:16
23:06:58.643 at async Promise.all (index 3)
23:06:58.643 at async node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:777:32
23:06:58.644 at async rewriteRequireExpressionsAndGetImportBlock (node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1354:28)
23:06:58.644 at async transformCommonjs (node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1928:23)
23:06:58.644 at async transform (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17593:16)
23:06:58.644
23:06:58.644 [error] Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/deps.js" and externals are not allowed!
23:06:58.764 Failed: Error while executing user command. Exited with error code: 1
23:06:58.770 Failed: build command exited with code: 1
23:07:00.213 Failed: error occurred while running build command
23:06:37.720 [info] [nitro] Building Nitro Server (preset: `cloudflare-pages`)
23:06:39.180 Connected to MongoDB
23:06:58.639 [error] [nitro] Error: Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/deps.js" and externals are not allowed!
23:06:58.640
23:06:58.640
23:06:58.640 undefined
23:06:58.642 [error] Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/deps.js" and externals are not allowed!
23:06:58.642 at Object.resolveId (node_modules/.pnpm/[email protected]/node_modules/nitropack/dist/shared/nitro.4ea992bc.mjs:1973:17)
23:06:58.642 at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18592:28)
23:06:58.643 at async resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17261:26)
23:06:58.643 at async ModuleLoader.resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17675:15)
23:06:58.643 at async node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:785:16
23:06:58.643 at async Promise.all (index 3)
23:06:58.643 at async node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:777:32
23:06:58.644 at async rewriteRequireExpressionsAndGetImportBlock (node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1354:28)
23:06:58.644 at async transformCommonjs (node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1928:23)
23:06:58.644 at async transform (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17593:16)
23:06:58.644
23:06:58.644 [error] Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/.pnpm/[email protected]/node_modules/mongodb/lib/deps.js" and externals are not allowed!
23:06:58.764 Failed: Error while executing user command. Exited with error code: 1
23:06:58.770 Failed: build command exited with code: 1
23:07:00.213 Failed: error occurred while running build command
nico
nicoOP•10mo ago
Seems like MongoDB is waiting for Support vom Cloudflare to implement that currently. https://www.mongodb.com/community/forums/t/cloudflare-workers-integration-is-now-possible/226708/13
MongoDB Developer Community Forums
Cloudflare Workers integration is now possible
@Alex_Bjorlig the challenge for the moment is that with only mTLS available we cannot provide our own TLS certificate/key to the socket layer. This prevents us from being able to support connections to MongoDB Atlas clusters. We’ll continue to work with Cloudflare on proper TLS support though, and share updates as they become available.
Want results from more Discord servers?
Add your server