Issue with Publishing SNS Message from Node.js Cron Job #5872
Unanswered
manuMijJustoMx
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello AWS Support,
I am experiencing an issue while attempting to publish a message to an SNS topic from a Node.js application, specifically from within a cron job. The operation consistently results in the following error:
"Cannot read properties of null (reading 'propagateTraceContextHeaders')"
This error occurs when emitting the event to publish a message to our designated SNS topic. Here is the stack trace of the error for your reference:
{"name":"@justomx/op-restocking-canceler","hostname":"op-restocking-canceler-5f46c7489d-sbn4k","pid":20,"level":50,"err":{"message":"Cannot read properties of null (reading 'propagateTraceContextHeaders')","name":"TypeError","stack":"TypeError: Cannot read properties of null (reading 'propagateTraceContextHeaders')\n at /opt/app/node_modules/elastic-apm-node/lib/instrumentation/modules/@aws-sdk/client-sns.js:52:22\n at _SNSClient.send (/opt/app/node_modules/@smithy/smithy-client/dist-cjs/index.js:122:14)\n at _SNSClient._wrappedSmithyClientSend (/opt/app/node_modules/elastic-apm-node/lib/instrumentation/modules/@smithy/smithy-client.js:174:21)\n at SnsRuleEventDispatcher.<anonymous> (/opt/app/dist/infrastructure/services/event-dispatcher/index.js:27:49)\n at Generator.next (<anonymous>)\n at /opt/app/dist/infrastructure/services/event-dispatcher/index.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/opt/app/dist/infrastructure/services/event-dispatcher/index.js:4:12)\n at SnsRuleEventDispatcher.emitRuleAfterCancellationEvent (/opt/app/dist/infrastructure/services/event-dispatcher/index.js:24:16)\n at RestockingCancelerProcessor.<anonymous> (/opt/app/dist/app/processor.js:69:51)\n at Generator.next (<anonymous>)\n at /opt/app/dist/app/processor.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/opt/app/dist/app/processor.js:4:12)\n at RestockingCancelerProcessor.emitEvent (/opt/app/dist/app/processor.js:67:16)\n at RestockingCancelerProcessor.<anonymous> (/opt/app/dist/app/processor.js:38:101)\n at Generator.next (<anonymous>)\n at /opt/app/dist/app/processor.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/opt/app/dist/app/processor.js:4:12)\n at /opt/app/dist/app/processor.js:38:36\n at EitherAsync.<anonymous> (/opt/app/node_modules/@justomx/either/lib/either-async.js:24:219)\n at Generator.next (<anonymous>)\n at /opt/app/node_modules/@justomx/either/lib/either-async.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/opt/app/node_modules/@justomx/either/lib/either-async.js:4:12)\n at /opt/app/node_modules/@justomx/either/lib/either-async.js:24:159\n at Either.fold (/opt/app/node_modules/@justomx/either/lib/either.js:19:24)\n at EitherAsync.<anonymous> (/opt/app/node_modules/@justomx/either/lib/either-async.js:24:32)\n at Generator.next (<anonymous>)\n at fulfilled (/opt/app/node_modules/@justomx/either/lib/either-async.js:5:58)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"},"msg":"Cannot read properties of null (reading 'propagateTraceContextHeaders')","time":"2024-03-07T18:24:05.041Z","v":0}
I am using the AWS SDK for JavaScript v3, with the "@aws-sdk/client-sns" library version "3.490.0". Despite attempting to update to the latest version of the library, the issue persists.
I am looking for guidance on how to resolve this issue. Could you provide any insights or suggestions on what might be causing this error and how to fix it? Is there a specific configuration or setup that I might be missing, especially regarding the integration with Elastic APM, as indicated by the error stack trace?
Any assistance or recommendations you could offer would be greatly appreciated, as this issue is impacting our ability to reliably publish SNS messages from our scheduled tasks.
Thank you for your time and assistance.
Best regards,
Manuel
Beta Was this translation helpful? Give feedback.
All reactions