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

Missing '../endpoint/endpointResolver' on @aws-sdk/client-s3 when deploying to Vercel #6614

Open
3 of 4 tasks
dwnppoalt opened this issue Nov 1, 2024 · 4 comments
Open
3 of 4 tasks
Assignees
Labels
bug This issue is a bug. p3 This is a minor priority issue

Comments

@dwnppoalt
Copy link

Checkboxes for prior research

Describe the bug

When deploying my project to Vercel, this error raises:

Cannot find module '../endpoint/endpointResolver'
Require stack:
- /var/task/node_modules/@aws-sdk/client-s3/dist-cjs/auth/httpAuthSchemeProvider.js
- /var/task/node_modules/@aws-sdk/client-s3/dist-cjs/index.js
- /var/task/public/scripts/s3.js
- /var/task/app.js
- /var/task/___now_launcher.js
- /var/runtime/index.mjs
Did you forget to add it to "dependencies" in `package.json`?
INIT_REPORT Init Duration: 738.01 ms	Phase: invoke	Status: error	Error Type: Runtime.ExitError

When I run it locally, it works fine.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/client-s3@^3.682.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.12.2

Reproduction Steps

N/A.

Observed Behavior

Cannot find module '../endpoint/endpointResolver'
Require stack:
- /var/task/node_modules/@aws-sdk/client-s3/dist-cjs/auth/httpAuthSchemeProvider.js
- /var/task/node_modules/@aws-sdk/client-s3/dist-cjs/index.js
- /var/task/public/scripts/s3.js
- /var/task/app.js
- /var/task/___now_launcher.js
- /var/runtime/index.mjs
Did you forget to add it to "dependencies" in `package.json`?
INIT_REPORT Init Duration: 738.01 ms	Phase: invoke	Status: error	Error Type: Runtime.ExitError

Expected Behavior

It should be imported normally.

Possible Solution

No response

Additional Information/Context

I import it to my s3.js file using:

const { S3Client, PutObjectCommand, GetObjectCommand, DeleteObjectCommand} = require('@aws-sdk/client-s3');
@dwnppoalt dwnppoalt added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 1, 2024
@kuhe
Copy link
Contributor

kuhe commented Nov 1, 2024

The file @aws-sdk/client-s3/dist-cjs/endpoint/endpointResolver.js exists in our distributed artifact, which can be verified by the code browser on https://www.npmjs.com/package/@aws-sdk/client-s3?activeTab=code. Did your build or deployment process omit it?

@kuhe kuhe added the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Nov 1, 2024
@dwnppoalt
Copy link
Author

dwnppoalt commented Nov 2, 2024

I don't think its in the build or install process. My project doesn't have a build command, and it only installs the dependencies through

npm install

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Nov 2, 2024
@aBurmeseDev aBurmeseDev self-assigned this Nov 5, 2024
@aBurmeseDev
Copy link
Member

Hi @dwnppoalt - this may be caused by a mismatch in the versions of the AWS SDK installed locally and on Vercel's deployment environment. What does your package.json look like?

One suggestion would be to update @aws-sdk/client-s3 package to the latest version with npm install @aws-sdk/client-s3. Please share your package.json if issue persists.

@aBurmeseDev aBurmeseDev added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Nov 5, 2024
@dwnppoalt
Copy link
Author

@aBurmeseDev I installed the AWS SDK on my local machine using npm install @aws-sdk/client-s3@latest. It installed version 3.682.0, which I used in my Vercel deployment.

This is my package.json:

  "name": "ins-api",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "node app.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "@aws-sdk/client-s3": "^3.682.0",
    "@aws-sdk/s3-request-presigner": "^3.682.0",
    "@aws-sdk/util-endpoints": "^3.679.0",
    "cors": "^2.8.5",
    "dotenv": "^16.4.5",
    "express": "^4.21.1",
    "jsonwebtoken": "^9.0.2",
    "multer": "^1.4.5-lts.1",
    "pg": "^8.13.1",
    "uuid": "^11.0.2"
  }
}

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

3 participants