Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@aws-sdk/client-sesv2 - Error: Cannot find module '@aws-sdk/util-endpoints' #4053

Closed
3 tasks done
subutuo opened this issue Oct 19, 2022 · 10 comments · Fixed by smithy-lang/smithy-typescript#619
Closed
3 tasks done
Labels
bug This issue is a bug. workaround-available This issue has a work around available.

Comments

@subutuo
Copy link

subutuo commented Oct 19, 2022

Checkboxes for prior research

Describe the bug

After upgrading @aws-sdk/client-sesv2 to version 3.191.0
Got a message Cannot find module '@aws-sdk/util-endpoints'

@aws-sdk/client-sesv2@3.191.0 history link

SDK version number

@aws-sdk/client-sesv2@3.191.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

node.js 14.16.0

Reproduction Steps

  "dependencies": {
    "@aws-sdk/client-api-gateway": "^3.13.1",
    "@aws-sdk/client-sesv2": "^3.11.0",
  }

Observed Behavior

Error: Cannot find module '@aws-sdk/util-endpoints'
Require stack:
- /node_modules/@aws-sdk/client-sesv2/dist-cjs/endpoint/endpointResolver.js
- /node_modules/@aws-sdk/client-sesv2/dist-cjs/runtimeConfig.shared.js
- /node_modules/@aws-sdk/client-sesv2/dist-cjs/runtimeConfig.js
- /node_modules/@aws-sdk/client-sesv2/dist-cjs/SESv2Client.js
- /node_modules/@aws-sdk/client-sesv2/dist-cjs/SESv2.js
- /node_modules/@aws-sdk/client-sesv2/dist-cjs/index.js
- /dist/aws/aws.ses.service.js
- /dist/email/email.service.js
- /dist/email/email.module.js
- /dist/auth/auth.module.js
- /dist/app.module.js
- /dist/main.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (/node_modules/@aws-sdk/client-sesv2/dist-cjs/endpoint/endpointResolver.js:4:26)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/node_modules/@aws-sdk/client-sesv2/dist-cjs/endpoint/endpointResolver.js',
    '/node_modules/@aws-sdk/client-sesv2/dist-cjs/runtimeConfig.shared.js',
    '/node_modules/@aws-sdk/client-sesv2/dist-cjs/runtimeConfig.js',
    '/node_modules/@aws-sdk/client-sesv2/dist-cjs/SESv2Client.js',
    '/node_modules/@aws-sdk/client-sesv2/dist-cjs/SESv2.js',
    '/node_modules/@aws-sdk/client-sesv2/dist-cjs/index.js',
    '/dist/aws/aws.ses.service.js',
    '/dist/email/email.service.js',
    '/dist/email/email.module.js',
    '/dist/auth/auth.module.js',
    '/dist/app.module.js',
    '/dist/main.js'
  ]
}

Expected Behavior

No errors at run time.

Possible Solution

No response

Additional Information/Context

No response

@subutuo subutuo added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 19, 2022
@nathan-fiscaletti
Copy link

Same issue with @aws-sdk/client-s3 in v3.192.0

@vishald2509
Copy link

vishald2509 commented Oct 19, 2022

I got the same error.

NODE VERSION: 16x

"@aws-sdk/client-s3": "^3.192.0",

   "Runtime.ImportModuleError: Error: Cannot find module '@aws-sdk/util-endpoints'",
    "Require stack:",
    "- /opt/nodejs/node_modules/@aws-sdk/client-s3/dist-cjs/endpoint/endpointResolver.js",
    "- /opt/nodejs/node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.shared.js",
    "- /opt/nodejs/node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js",
    "- /opt/nodejs/node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js",
    "- /opt/nodejs/node_modules/@aws-sdk/client-s3/dist-cjs/S3.js",
    "- /opt/nodejs/node_modules/@aws-sdk/client-s3/dist-cjs/index.js",
    "- /var/task/config/s3Client.js",
    "- /var/task/index.js",
    "- /var/runtime/index.mjs",
    "    at _loadUserApp (file:///var/runtime/index.mjs:951:17)",
    "    at async Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:976:21)",
    "    at async start (file:///var/runtime/index.mjs:1137:23)",
    "    at async file:///var/runtime/index.mjs:1143:1"

@ddolcimascolo
Copy link

Hi guys, same here. Should you need anything to help diagnose, just ask.

Keep up the good work!

Cheers,
David

jmartin4563 added a commit to jmartin4563/node-newrelic-aws-sdk that referenced this issue Oct 19, 2022
Version 3.192.0 released today and is busted, so until aws/aws-sdk-js-v3#4053 is fixed, we're locking down to lower versions to fix CI
@trivikr trivikr removed the needs-triage This issue or PR still needs to be triaged. label Oct 19, 2022
@trivikr
Copy link
Member

trivikr commented Oct 19, 2022

Acknowledged that this is a bug.

It can be temporarily fixed by adding @aws-sdk/util-endpoints in your project dependency:

  • npm install @aws-sdk/util-endpoints
  • yarn add @aws-sdk/util-endpoints
  • pnpm add @aws-sdk/util-endpoints

Another option is to pin client version to <=v3.191.0 of clients

  • npm install @aws-sdk/client-sesv2@3.191.0 --save-exact
  • yarn add @aws-sdk/client-sesv2@3.191.0 --save-exact
  • pnpm add @aws-sdk/client-sesv2@3.191.0 --save-exact

We'll attempt to push fix in v3.193.0 on Thu, Oct 20

@trivikr trivikr added the workaround-available This issue has a work around available. label Oct 19, 2022
@ningaro
Copy link

ningaro commented Oct 19, 2022

In our project we use @aws-sdk/client-s3 and we recently had the same error.

Pin dependencie version to 3.188.0 helped us

"dependencies": {
+    "@aws-sdk/client-s3": "3.188.0"
-    "@aws-sdk/client-s3": "^3.188.0"
}

@trivikr
Copy link
Member

trivikr commented Oct 19, 2022

This happens as resolveEndpoint is called from @aws-sdk/util-endpoints

import { EndpointParams, resolveEndpoint } from "@aws-sdk/util-endpoints";

However, it's not added as a dependency in package.json

"dependencies": {
"@aws-crypto/sha256-browser": "2.0.0",
"@aws-crypto/sha256-js": "2.0.0",
"@aws-sdk/client-sts": "*",
"@aws-sdk/config-resolver": "*",
"@aws-sdk/credential-provider-node": "*",
"@aws-sdk/fetch-http-handler": "*",
"@aws-sdk/hash-node": "*",
"@aws-sdk/invalid-dependency": "*",
"@aws-sdk/middleware-content-length": "*",
"@aws-sdk/middleware-endpoint": "*",
"@aws-sdk/middleware-host-header": "*",
"@aws-sdk/middleware-logger": "*",
"@aws-sdk/middleware-recursion-detection": "*",
"@aws-sdk/middleware-retry": "*",
"@aws-sdk/middleware-serde": "*",
"@aws-sdk/middleware-signing": "*",
"@aws-sdk/middleware-stack": "*",
"@aws-sdk/middleware-user-agent": "*",
"@aws-sdk/node-config-provider": "*",
"@aws-sdk/node-http-handler": "*",
"@aws-sdk/protocol-http": "*",
"@aws-sdk/smithy-client": "*",
"@aws-sdk/types": "*",
"@aws-sdk/url-parser": "*",
"@aws-sdk/util-base64-browser": "*",
"@aws-sdk/util-base64-node": "*",
"@aws-sdk/util-body-length-browser": "*",
"@aws-sdk/util-body-length-node": "*",
"@aws-sdk/util-defaults-mode-browser": "*",
"@aws-sdk/util-defaults-mode-node": "*",
"@aws-sdk/util-user-agent-browser": "*",
"@aws-sdk/util-user-agent-node": "*",
"@aws-sdk/util-utf8-browser": "*",
"@aws-sdk/util-utf8-node": "*",
"tslib": "^2.3.1"
},

The fix in the SDK would be similar to what's done by @JagWireZ in #4055, but it would be codegen.

@trivikr
Copy link
Member

trivikr commented Oct 19, 2022

The issue is in EndpointsV2Generator.java which adds @aws-sdk/util-endpoints dependency in the source code, but not in package.json

https://github.com/awslabs/smithy-typescript/blob/334a06d06327b98a9f1f8892205d98d88651b887/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/endpointsV2/EndpointsV2Generator.java#L146-L147

@trivikr
Copy link
Member

trivikr commented Oct 20, 2022

This issue is fixed in v3.193.0

Source code
import { SESv2 } from "@aws-sdk/client-sesv2";

const client = new SESv2({});
console.log(await client.listConfigurationSets({}));
Cannot find module error with @aws-sdk/client-sesv2@3.192.0
node:internal/modules/cjs/loader:985
  const err = new Error(message);
              ^

Error: Cannot find module '@aws-sdk/util-endpoints'
Require stack:
- /Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/endpoint/endpointResolver.js
- /Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/runtimeConfig.shared.js
- /Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/runtimeConfig.js
- /Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/SESv2Client.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
    at Function.Module._load (node:internal/modules/cjs/loader:833:27)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/endpoint/endpointResolver.js:4:26)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Module.require (node:internal/modules/cjs/loader:1057:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/endpoint/endpointResolver.js',
    '/Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/runtimeConfig.shared.js',
    '/Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/runtimeConfig.js',
    '/Users/trivikr/workspace/test/node_modules/@aws-sdk/client-sesv2/dist-cjs/SESv2Client.js'
  ]
}
No error with @aws-sdk/client-sesv2@3.193.0
{
  '$metadata': {
    // Redacted
  },
  ConfigurationSets: []
}

@github-actions
Copy link

github-actions bot commented Nov 4, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. workaround-available This issue has a work around available.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants