Skip to content

Got 10 doesn't work with AWS XRay in lambda #240

@MickVanDuijn

Description

@MickVanDuijn

Describe the bug

  • Node.js version: 10.x and 12.x
  • OS & version: AWS Lambda, Got 10

This occurs when using Got 10 in combination with AWS XRay on AWS Lambda. Note: Got 9 works fine with the provided snippet.

I also opened an issue on the got repository.

Actual behavior

Whenever XRay capture is enabled, the lambda doesn't return any response, and the actual request is made against https://localhost. Subsequent executions take longer and longer (even up to 2 minutes) until finally one execution will show a bunch of LAMBDA_RUNTIME_ERROR.

Edit: the lambda execution actually dies midway, while without XRay enabled, it successfully completes.

Expected behavior

Get contents of google.com and return the specified response (body: 'ok')

Code to reproduce

require('aws-xray-sdk-core').captureHTTPsGlobal(require('https'))
const got = require('got')

export async function handler() {
    await got.get(`https://google.com`)

    return {
        statusCode: 200,
        body: 'ok',
    }
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions