dougmoscrop / serverless-http

Use your existing middleware framework (e.g. Express, Koa) in AWS Lambda 🎉
Other
1.74k stars 167 forks source link

does not work with serverless-offline plugin in serverless framework #26

Closed jonni-larjomaa closed 7 years ago

jonni-larjomaa commented 7 years ago

Hi,

This is a really nice tool and love the idea of just mocking the request and response layers, but, for some reason with serverless-offline plugin in serverless framework i always get empty body in response, also the write function in response object never gets called, (although the assignSocket stub does get all the data).

dougmoscrop commented 7 years ago

Thanks, I'll take a look when I get a chance. If you find anything else let me know!

jonni-larjomaa commented 7 years ago

and just let you know i'm using following libs.

node 8.5.0 express 4.15.2 serverless-http 1.5.0

mvayngrib commented 7 years ago

@jonni-larjomaa works for me with:

node 7.10.1 express 4.15.4 serverless-http 1.5.0

i'm using curl (not sls invoke). Both GET and POST worked for me (POST with some json body in both request and response)

jonni-larjomaa commented 7 years ago

@mvayngrib @dougmoscrop

Yeah it looks like there is something changing in nodejs 8 compared to 6 and 7 as i got this working with nodejs 6.11 and node 7.10 but it does not work with nodejs 8.5. maybe its a bug in the nodejs environment or so.

dougmoscrop commented 7 years ago

I've fixed a bug to support node 8, and all tests (in node 4,5,6,7,8) are passing in CI

can you try changing your dependency to github:dougmoscrop/serverless-http#node8 and seeing if it works? if so I will release on npm.

mvayngrib commented 7 years ago

@dougmoscrop i can confirm that on node 6.10.3 it still works (the one AWS uses for its Node.js environment)

dougmoscrop commented 7 years ago

thanks! I got confirmation elsewhere that it worked with offline and on node 8 so I am inclined to close this but please reopen if there's any more issues. 1.5.1 has been released.