I just migrated from sls offline 3.31.3 (sls 1.36.1) to sls offline 6.8.0 (sls 2.17.0) and all my preflight (OPTIONS) requests are left hanging. Trying to investigate I ended up in the HAPI library in the _lifecycle method, where this._route._cycle has 2 functions, 1st one being internal.drain which ends up setting the _eventContext.request to null here, thus ignoring the 2nd function in the _route._cycle here. If I remove the 1st function manually from the _route._cycle everything works fine.
GET works correctly on the resources.
Sample Code
...
functions:
findTags:
handler: src/.../handler/path/...
events:
- http:
method: GET
path: tags
cors: true
...
Environment
serverless version: 2.17.0serverless-offline version: 6.8.0node.js version: v15.5.0OS: Ubuntu 20.04.1 LTSDowngrading Node to v14.15.3 fixed the problem.
It was a bug in 15.5.0. The change was reverted as part of 15.6.0, so you can use 15.4.0 or 15.6.0 too.
Most helpful comment
Downgrading Node to v14.15.3 fixed the problem.