1

I can locally execute the lambda with serverless offline, I've set AWS_DAEMON_ADRESS to '127.0.0.1:2000' in the .env file, but the running daemon listening to this port do not receive any data from the execution. The trouble is that the same code executed with an online lambda works, and the xray service map is correctly feed. Did I miss something in the offline configuration ?

This is a nodeJS 8.10 lambda, triggered with Postman on localhost:3000. I've tried to set the daemon adress (127.0.0.1) directly in the lambda's function code, and when sls receive the call it says the deamon adress is already configured (with the .env variable).

I've activated the tracing on apiGateway and lambda in serverless.yml file, and the daemon receives info when I echo anything to /dev/udp/127.0.0.1/2000

const xray = require('aws-xray-sdk')
const aws = require('aws-sdk')
xray.captureAWS(aws)

I except the local daemon to receive some info from the offline lambda execution but nothing happens

Noddin
  • 11
  • 1

1 Answers1

1

Are you using SAM local? Unfortunately, they do not have the hook-ups for X-Ray at the moment. https://github.com/awslabs/aws-sam-cli/issues/217

AWSSandra
  • 374
  • 1
  • 7
  • Yes, I'm using SAM local. I tried to export a well formated (but random) trace-id as parent, but there is really no reaction deamon-side – Noddin Jun 24 '19 at 13:39
  • Do you think that using Cloud9 can solve the no hook-ups local mode issue ? – Noddin Jun 25 '19 at 08:58
  • Trace ID can't be random, because a portion of it includes a timestamp - The format is here: https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-tracingheader - Additionally, the X-Ray SDK expects the root segment to already be sent by Lambda - the behaviour on Lambda is unique (also the various SDKs handle this a bit differently under the hood) - see this post here for further clarification: https://github.com/aws/aws-xray-sdk-go/issues/126 – AWSSandra Jun 25 '19 at 23:29
  • I'm not too sure about Cloud9, unfortunately - I didn't find anything there in regard to X-Ray. – AWSSandra Jun 25 '19 at 23:36