nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
835 stars 39 forks source link

Build Error: External Dependency Resolution Issue #139

Closed chihebnabil closed 1 month ago

chihebnabil commented 1 month ago

Describe the bug

The build process fails with an error message "Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/mongodb/lib/deps.js" and externals are not allowed!"

Steps to reproduce

  1. Build a Nuxt.js application.

Expected behavior

The build process should complete successfully.

Additional Information

Possible Causes

  1. Missing dependency: The @aws-sdk/credential-providers package might not be installed in your project.
  2. Incorrect configuration: There might be an issue with the configuration of external dependencies (indicated by "externals are not allowed!").
17:43:23.356 [error] Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/mongodb/lib/deps.js" and externals are not allowed!
17:43:23.357   at Object.resolveId (node_modules/nitropack/dist/nitro.mjs:1966:17)
17:43:23.357   at async PluginDriver.hookFirstAndGetPlugin (node_modules/rollup/dist/es/shared/node-entry.js:19674:28)
17:43:23.357   at async resolveId (node_modules/rollup/dist/es/shared/node-entry.js:18355:26)
17:43:23.357   at async ModuleLoader.resolveId (node_modules/rollup/dist/es/shared/node-entry.js:18758:15)
17:43:23.357   at async node_modules/@rollup/plugin-commonjs/dist/es/index.js:785:16
17:43:23.357   at async Promise.all (index 3)
17:43:23.357   at async node_modules/@rollup/plugin-commonjs/dist/es/index.js:777:32
17:43:23.358   at async rewriteRequireExpressionsAndGetImportBlock (node_modules/@rollup/plugin-commonjs/dist/es/index.js:1354:28)
17:43:23.358   at async transformCommonjs (node_modules/@rollup/plugin-commonjs/dist/es/index.js:1933:23)
17:43:23.358   at async transform (node_modules/rollup/dist/es/shared/node-entry.js:18676:16) 
17:43:23.358 
17:43:23.358 [error] Cannot resolve "@aws-sdk/credential-providers" from "/opt/buildhome/repo/node_modules/mongodb/lib/deps.js" and externals are not allowed!
17:43:23.516 Failed: Error while executing user command. Exited with error code: 1
17:43:23.526 Failed: build command exited with code: 1
17:43:24.946 Failed: error occurred while running build command
"dependencies": {
    "@firebase/app-types": "^0.9.1",
    "@iconify-json/heroicons": "^1.1.20",
    "@iconify-json/simple-icons": "^1.1.97",
    "@mongodb-js/zstd": "^1.2.0",
    "@nuxt/content": "^2.12.1",
    "@nuxt/fonts": "^0.5.1",
    "@nuxt/ui-pro": "^1.1.0",
    "@nuxthub/core": "^0.5.18",
    "@pinecone-database/pinecone": "^2.2.1",
    "fast-xml-parser": "^4.3.6",
    "firebase": "^10.10.0",
    "firebase-admin": "^11.11.1",
    "firebase-functions": "^4.8.2",
    "mongoose": "^8.4.0",
    "nuxt": "^3.11.1",
    "nuxt-vuefire": "^1.0.2",
    "openai": "^4.47.1",
    "vuefire": "^3.1.23"
  },
farnabaz commented 1 month ago

Hey @chihebnabil Edge workers are not yet compatible with Mongo, that is the main reason for failing to build. Checkout https://nitro.unjs.io/deploy/workers#mongodb

chihebnabil commented 1 month ago

@farnabaz What a bummer!, thank you :smile: