Current Behavior
When sending a non-GET (e.g. POST) request to an httpApi endpoint, the request hangs. This doesn't happen with GET requests.
Sample Code
https://github.com/s16h/sls-offline-hanging-repro
Expected behavior/code
The expectation is that a POST request should return a response.
Environment
serverless version: 2.16.1serverless-offline version: 6.8.0node.js version: v15.5.0OS: macOS 11.1python version: 2.7.16 and 3.9.1 (Haven't tested with other versions)Same behavior on my system from this morning too. I'm using typescript in an Ubuntu 20 machine. So, I think it could be related to a change either in the serverless-offline plugin or in the serverless framework itself. Maybe an analytics request on their side is hanging. The use of export SLS_DEBUG=true is not giving any clues either.
I just started experiencing this exact issue today as well.
serverless: 2.16.1
serverless-offline: 6.8.0
node.js: v15.5.0
OS: macOS 10.15.4
I'm experiencing this problem as well.
Same here. Temporary downgrading node from v15.5.0 helped.
To fix this, it's important that your yarn does not install node 15 as a dependency, which will happen if you use homebrew to install it. Here's how we brute-forced it:
brew deps -n node # uninstall all of these
brew uninstall node
brew uninstall yarn
node --version # should not work
yarn --version # should not work
brew install node@14
brew link node@14
node --version # should work, be 14.x
npm install -g yarn
hash -r
yarn --version
# re-install other things you uninstalled
It's possible that removing all the dependencies is unnecessary, so you could try just uninstalling yarn, unlinking node@15, and then re-installing yarn with npm and not homebrew. Haven't run the following but the commands would be something like:
brew uninstall yarn
brew unlink node
node --version # should not work
brew install node@14
brew link node@14
npm install -g yarn
hash -r
yarn --version
It's nearly certain someone who knows more command line flags of brew would be able to finesse this with less carnage, but I assume this will be resolved quickly.
@mrflip did you know about "n"? I use this for a quite long time now and this is great!
Same issue here. This is a pretty nasty blocker for using the new node js. I'm curious to learn which node js feature changed that this depended on. 馃
Same here, had to downgrade node to v14.
I also downgraded node to v14 and it worked.
Is there a fix coming for node 15?
Culprit found!!! Thanks to https://github.com/dherault/serverless-offline/issues/1150#issuecomment-750866436
After my several tests, only Node v15.5.0 and v15.5.1 are not working.
I was using node v12.16.1, upgraded to v14.16.1 still the same issue.
Can confirm with 15*, 14.16.1 works.
Maybe it isn't coz of the node version? Coz I confirm that I am using the current LTS node v14.16.1 with the same problem. (Also all my API works just fine when deployed on AWS or invoked locally using sls invoke local)
To fix this, it's important that your yarn does not install node 15 as a dependency, which will happen if you use homebrew to install it.
Does that mean I might have multiple versions of node in my system? Can you please add some more info that why it fixes the issue or the issue appears at all? BDW I use npm and I don't have yarn.
Works well on Node 15.14.0. Tested
I just ran into this as well - was on node v12.16.1 and had to upgrade to node 14.16.1
Most helpful comment
Same here. Temporary downgrading node from
v15.5.0helped.