Skip to content

Lambda instrumentation interferes with return value for first invocation after a deploy #2166

@astorm

Description

@astorm

We're seeing behavior where our instrumentation interferes with the usual return value after a function's initial deployment.

  1. Create a Lambda Function hooked up to API Gateway
  2. Configure the env variables ELASTIC_APM_SECRET_TOKEN, ELASTIC_APM_SERVER_URL, and ELASTIC_APM_SERVICE_NAME with legitimate values
  3. Ensures the Lambda's node_modules folder contains the elastic-apm-node source and its dependencies
  4. Change your lambda source so it looks like the following
     const apm = require('elastic-apm-node').start()
     exports.handler = apm.lambda(function handler (event, context, callback) {
       callback(null, `Hello World`)
     })
    
    
  5. Click the Deploy Button
  6. Invoke your function via its API gateway URL or the aws cli invoke command two times

Expected Behavior: Function returns value Hello World

Actual Behavior: The first invocation after a deploy returns null -- subsequent invocations return the expected Hello World value

Metadata

Metadata

Assignees

Labels

agent-nodejsMake available for APM Agents project planning.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions