Skip to content

Error requiring ESM with v3.1.0 #147

@christian-bahnweg

Description

@christian-bahnweg

I'm attempting to use serverless-auto-swagger with serverless v2.72 and getting the following error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/atlassian/pipelines/agent/build/node_modules/serverless-auto-swagger/node_modules/brace-expansion/index.js from /opt/atlassian/pipelines/agent/build/node_modules/serverless-auto-swagger/node_modules/minimatch/dist/commonjs/index.js not supported.
  Instead change the require of /opt/atlassian/pipelines/agent/build/node_modules/serverless-auto-swagger/node_modules/brace-expansion/index.js in /opt/atlassian/pipelines/agent/build/node_modules/serverless-auto-swagger/node_modules/minimatch/dist/commonjs/index.js to a dynamic import() which is available in all CommonJS modules.
      at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/serverless-auto-swagger/node_modules/minimatch/dist/commonjs/index.js:7:43)
      at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/serverless-auto-swagger/node_modules/glob/dist/commonjs/index.js:9:21)
      at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/serverless-auto-swagger/dist/ServerlessAutoSwagger.js:16:16)
      at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/serverless-auto-swagger/dist/index.js:3:33)
      at PluginManager.requireServicePlugin (/opt/atlassian/pipelines/agent/build/node_modules/serverless/lib/classes/PluginManager.js:164:14)
      at /opt/atlassian/pipelines/agent/build/node_modules/serverless/lib/classes/PluginManager.js:186:27
      at Array.map (<anonymous>)
      at PluginManager.resolveServicePlugins (/opt/atlassian/pipelines/agent/build/node_modules/serverless/lib/classes/PluginManager.js:183:10)
      at PluginManager.loadAllPlugins (/opt/atlassian/pipelines/agent/build/node_modules/serverless/lib/classes/PluginManager.js:139:10)
      at Serverless.init (/opt/atlassian/pipelines/agent/build/node_modules/serverless/lib/Serverless.js:213:30)
      at async /opt/atlassian/pipelines/agent/build/node_modules/serverless/scripts/serverless.js:589:7
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Get Support --------------------------------------------
     Docs:          [docs.serverless.com](http://docs.serverless.com/)
     Bugs:          [github.com/serverless/serverless/issues](http://github.com/serverless/serverless/issues)
     Issues:        [forum.serverless.com](http://forum.serverless.com/)
 
  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              20.9.0
     Framework Version:         2.72.4 (local)
     Plugin Version:            5.5.4
     SDK Version:               4.5.1
     Components Version:        3.18.2

Has anyone else seen this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions