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

SQS instrumentation can cause Errors #2113

Closed
1 of 3 tasks
jakedaleweb opened this issue Jun 16, 2021 · 3 comments · Fixed by #2114
Closed
1 of 3 tasks

SQS instrumentation can cause Errors #2113

jakedaleweb opened this issue Jun 16, 2021 · 3 comments · Fixed by #2114
Assignees
Labels
agent-nodejs Make available for APM Agents project planning.

Comments

@jakedaleweb
Copy link

Describe the bug

When a transaction is not set and and sqs.sendMessage is called an error is thrown:
Cannot read property 'setDestinationContext' of null

This was introduced in the SQS instrumentation added in version 3.14.0.

The problem is that span can be null here but there is no check for that case - https://github.com/elastic/apm-agent-nodejs/blob/master/lib/instrumentation/modules/aws-sdk/sqs.js#L154-L156

image

Expected behavior

No error, should be handled gracefully.

Environment (please complete the following information)

  • OS: Linux
  • Node.js version: 16.3.0
  • Agent version: 3.15.0 (present in 3.14.0 upwards)

How are you starting the agent? (please tick one of the boxes)

  • Calling agent.start() directly (e.g. require('elastic-apm-node').start(...))
  • Requiring elastic-apm-node/start from within the source code
  • Starting node with -r elastic-apm-node/start

Additional context

  • Agent config options

    Click to expand
    serviceName: 'servicename',
    secretToken: 'mysecret',
    serverUrl: 'https://myserver',
    active: true
    
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Jun 16, 2021
@jakedaleweb
Copy link
Author

Have tried to provide all the detail I can here, but I am not overly familiar with elastic-apm-node, let me know if I can help out with any other information (:

@astorm
Copy link
Contributor

astorm commented Jun 16, 2021

Thanks for reporting @jakedaleweb -- your level of detail was perfect. We were able to reproduce the behavior you described. We've got a PR going to fix this error. If you have a moment and could test your specific crashing use case with this branch that'd be great -- but no worries if not.

@jakedaleweb
Copy link
Author

Wow, thanks for such a speedy response. This is fantastic! 🎉

I won't have an opportunity to test this, but it looks good to me.

Thanks again!

astorm added a commit that referenced this issue Jun 17, 2021
* fix: SQS crashing error with no active transaction

#2113
dgieselaar pushed a commit to dgieselaar/apm-agent-nodejs that referenced this issue Sep 10, 2021
* fix: SQS crashing error with no active transaction

elastic#2113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants