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

3.178.0 may break @aws-sdk/s3-request-presigner getSignedUrl #3983

Closed
3 tasks done
bmccann36 opened this issue Sep 23, 2022 · 13 comments
Closed
3 tasks done

3.178.0 may break @aws-sdk/s3-request-presigner getSignedUrl #3983

bmccann36 opened this issue Sep 23, 2022 · 13 comments
Assignees
Labels
bug This issue is a bug. needs-review This issue/pr needs review from an internal developer. p1 This is a high priority issue workaround-available This issue has a work around available.

Comments

@bmccann36
Copy link

bmccann36 commented Sep 23, 2022

Checkboxes for prior research

Describe the bug

3 hours ago there was a release to version 3.178.0. We are using npm i not ci in our pipeline so a newer version was installed. We did not change anything in our code but after the new build we started seeing this when our code tried to execute import {getSignedUrl} from '@aws-sdk/s3-request-presigner'

2022-09-23T21:25:54.847Z	undefined	ERROR	Uncaught Exception 	{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module '@aws-sdk/middleware-endpoint'\nRequire stack:\n- /opt/nodejs/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/getSignedUrl.js\n- /opt/nodejs/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js\n- /var/task/api/services/businessLogic/asset-logic.js\n- /var/task/api/services/businessLogic/inbound-ticket/inbound-ticket-logic.js\n- /var/task/handlers/inbound-ticket-handler.js\n- /var/runtime/UserFunction.js\n- /var/runtime/Runtime.js\n- /var/runtime/index.js",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module '@aws-sdk/middleware-endpoint'",
        "Require stack:",
        "- /opt/nodejs/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/getSignedUrl.js",
        "- /opt/nodejs/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js",

If we change our package.json from
"@aws-sdk/s3-request-presigner": "^3.178.0" => "@aws-sdk/s3-request-presigner": "3.67.0"
it fixes the issue

SDK version number

@aws-sdk/s3-request-presigner@3.178.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

node 14 on AWS Lambda

Reproduction Steps

  • make a typescript node project
  • install dependencies
  • execute a file with these contents in node
import {getSignedUrl} from '@aws-sdk/s3-request-presigner';
import {GetObjectCommand, S3Client,} from '@aws-sdk/client-s3';
const client = new S3Client({});
const command = new GetObjectCommand({Key: '123', Bucket: 'abc'});
getSignedUrl(client, command).then(console.log)

Observed Behavior

➜  scratch node --version
v16.17.0
➜  scratch node scratch.js
node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module '@aws-sdk/middleware-endpoint'
Require stack:
- /Users/brianmccann/Desktop/scratch/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/getSignedUrl.js
- /Users/brianmccann/Desktop/scratch/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js
- /Users/brianmccann/Desktop/scratch/scratch.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/brianmccann/Desktop/scratch/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/getSignedUrl.js:4:31)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/brianmccann/Desktop/scratch/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/getSignedUrl.js',
    '/Users/brianmccann/Desktop/scratch/node_modules/@aws-sdk/s3-request-presigner/dist-cjs/index.js',
    '/Users/brianmccann/Desktop/scratch/scratch.js'
  ]
}

Expected Behavior

I am able to call getSignedUrl

Possible Solution

No response

Additional Information/Context

No response

@bmccann36 bmccann36 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 23, 2022
@bmccann36
Copy link
Author

looks like this is a dupe of #3981

@ahmed-sharief5
Copy link

Even i am facing the same issue. Could anyone resolve this

@mdesousa
Copy link

as a workaround while the issue is fixed, we've added @aws-sdk/middleware-endpoint to our package.json and that solved the problem

@ianwremmel
Copy link

as a workaround while the issue is fixed, we've added @aws-sdk/middleware-endpoint to our package.json and that solved the problem

I tried this and discovered other packages also seem to be missing from dep tree.

@appleinautumn
Copy link

as a workaround while the issue is fixed, we've added @aws-sdk/middleware-endpoint to our package.json and that solved the problem

mdesousa's workaround works.

@thangchinh
Copy link

This is exactly what I got today. Change to older version fix this problem.

@ahmed-sharief5
Copy link

Even after installing the package separately it shows Cannot find module. Could the owner fix this issue please. Its causing our application to down from 3 days

@aitchkhan
Copy link

@ahmed-sharief5 try using an older version.

@ahmed-sharief5
Copy link

ahmed-sharief5 commented Sep 26, 2022

@aitchkhan Please let me know the version number

@yenfryherrerafeliz yenfryherrerafeliz self-assigned this Sep 26, 2022
@yenfryherrerafeliz
Copy link
Contributor

Hi @bmccann36, thanks for opening this issue. I can confirm this is an issue and we will work on getting this fixed as soon as possible. In the meantime we have two workarounds. Please see below:

  • The first one is to use the version 3.173.0 which does not contains this bug:
    • yarn add @aws-sdk/s3-request-presigner@3.173.0
  • The second workaround is to install the missing dependency manually:
    • yarn add @aws-sdk/middleware-endpoint

I will use this thread to provide updates accordingly.

Thanks!

@yenfryherrerafeliz yenfryherrerafeliz added needs-review This issue/pr needs review from an internal developer. workaround-available This issue has a work around available. p1 This is a high priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Sep 26, 2022
@imkumawat
Copy link

I have Nodejs code running on aws fargate container. What I did just add one logic, tested code and pushed code to github. And AWS started pipeline process. When deployment failed I checked cloud watch to know why its failed. So I found that my Nodejs code requrire one package to run @aws-sdk/middleware-endpoint. When I tested my nodejs code in my local system I didn't received any such error.
After reading this error I installed package @aws-sdk/middleware-endpoint and my server is running well. I am willing to know why @aws-sdk/middleware-endpoint is required suddenly. Although previously my all apis are working fine in same aws server, But today I saw requirement of @aws-sdk/middleware-endpoint.

Anyone can help me what is need of @aws-sdk/middleware-endpoint?
1

@yenfryherrerafeliz
Copy link
Contributor

Hi @bmccann36, this issue has been fixed by the following PR.

Thanks!

@github-actions
Copy link

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 Oct 12, 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. needs-review This issue/pr needs review from an internal developer. p1 This is a high priority issue workaround-available This issue has a work around available.
Projects
None yet
Development

No branches or pull requests

9 participants