dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.16k stars 794 forks source link

Fix: Restore missing import for Headers in invocationsRoute #1747

Closed gmazur92 closed 7 months ago

gmazur92 commented 7 months ago

Description

This pull request addresses an issue in the invocationsRoute module. The problem was identified as a missing import statement for the Headers class from 'node-fetch,' leading to a "ReferenceError: Headers is not defined" error, particularly evident during attempts to invoke AWS Lambda locally via:

const lambda = new AWS.Lambda({ endpoint: 'http://localhost:3002' });

Motivation and Context

The absence of the import for Headers resulted in a severe malfunction of the invocationsRoute module, impacting the proper parsing of headers during local AWS Lambda invocation.

How Has This Been Tested?

I tested these changes locally by reproducing the issue and ensuring that the error is resolved after adding the missing import. Tested on Node 18, serverless-offline 13.3.1.

dnalborczyk commented 7 months ago

@gmazur92 you might be using an unsupported node.js version.