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

Application stack trace is not shown #5988

Closed
3 tasks done
dimonnwc3 opened this issue Apr 10, 2024 · 4 comments
Closed
3 tasks done

Application stack trace is not shown #5988

dimonnwc3 opened this issue Apr 10, 2024 · 4 comments
Assignees
Labels
guidance General information and guidance, answers to FAQs, or recommended best practices/resources.

Comments

@dimonnwc3
Copy link

Checkboxes for prior research

Describe the bug

While using aws s3 send method, with any command producing the error. Error stack trace points to some internal AWS library code rather than application code where send methid is called.

SDK version number

@aws-sdk/client-s3@3.552.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v21.6.2

Reproduction Steps

call s3 client send method with any command that throws an error

for example:

import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3"

export const s3Client = new S3Client()

await s3Client.send(
  new GetObjectCommand({
    Bucket: "bucketName",
    Key: "unknown",
  }),
)

Observed Behavior

here is example stack trace, which shows some internal of the library, but doesn't include my application code

/Users/dimonn/sandbox/test/node_modules/@smithy/smithy-client/dist-cjs/index.js:838
  const response = new exceptionCtor({
                   ^

PermanentRedirect: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
    at throwDefaultError (/Users/dimonn/sandbox/test/node_modules/@smithy/smithy-client/dist-cjs/index.js:838:20)
    at /Users/dimonn/sandbox/test/node_modules/@smithy/smithy-client/dist-cjs/index.js:847:5
    at de_CommandError (/Users/dimonn/sandbox/test/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:4756:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/dimonn/sandbox/test/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
    at async /Users/dimonn/sandbox/test/node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js:225:18
    at async /Users/dimonn/sandbox/test/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
    at async /Users/dimonn/sandbox/test/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/index.js:173:18
    at async /Users/dimonn/sandbox/test/node_modules/@aws-sdk/client-s3/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:97:20
    at async /Users/dimonn/sandbox/test/node_modules/@aws-sdk/client-s3/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:120:14 {
  '$fault': 'client',
  '$metadata': {
    httpStatusCode: 301,
    requestId: 'ZCWE2NJ9XZH0X98N',
    extendedRequestId: 'gL1X0o1IpLrxn1qj/qw9kZSkwHF+RsOZr2hZEOZEtmrvjY+8fKkLgFE23v9i/KMxgYW+s7DT4GM=',
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
  Code: 'PermanentRedirect',
  Endpoint: 's3.amazonaws.com',
  Bucket: 'bucketName',
  RequestId: 'ZCWE2NJ9XZH0X98N',
  HostId: 'gL1X0o1IpLrxn1qj/qw9kZSkwHF+RsOZr2hZEOZEtmrvjY+8fKkLgFE23v9i/KMxgYW+s7DT4GM='
}

Expected Behavior

I expect stack trace to show where error happens in my application code

example when I throw error by myself, stack trace shows exact error in my code

file:///Users/dimonn/sandbox/test/s3.js:5
throw new Error("aaa")
      ^

Error: aaa
    at file:///Users/dimonn/sandbox/test/s3.js:5:7
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:120:12

Possible Solution

No response

Additional Information/Context

No response

@dimonnwc3 dimonnwc3 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 10, 2024
@kuhe
Copy link
Contributor

kuhe commented Apr 11, 2024

increase the stack trace limit with https://nodejs.org/api/errors.html#errorstacktracelimit.

@kuhe kuhe added closing-soon This issue will automatically close in 4 days unless further comments are made. and removed bug This issue is a bug. labels Apr 11, 2024
@dimonnwc3
Copy link
Author

I tried but nothing is changed

@kuhe kuhe added guidance General information and guidance, answers to FAQs, or recommended best practices/resources. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Apr 11, 2024
@RanVaknin
Copy link
Contributor

RanVaknin commented Apr 22, 2024

Hi @dimonnwc3 ,

What you are describing here is not unique to the SDK. This is known limitation of NodeJS as explained here. This is a common challenge with async programming in JS and is due to v8's zero cost async stack traces.
You can try running your application with $ node --async-stack-traces codeSnippet.js to see if it solves your problem.

Since this is not an SDK issue, and not actionable by the SDK team Im going to go ahead and close this issue.

Thanks for taking the time and reaching out.

All the best,
Ran~

@RanVaknin RanVaknin self-assigned this Apr 22, 2024
@RanVaknin RanVaknin removed the needs-triage This issue or PR still needs to be triaged. label Apr 22, 2024
@RanVaknin RanVaknin closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
Copy link

github-actions bot commented May 7, 2024

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 May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
guidance General information and guidance, answers to FAQs, or recommended best practices/resources.
Projects
None yet
Development

No branches or pull requests

3 participants