You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ALB event documentation allows specifying multiple methods. However if I try to run my configuration using serverless-offline, only the top method is used.
Current Behavior
Sample Code
file: serverless.yml
service: my-serviceplugins:
- serverless-webpack
- serverless-offlinecustom:
serverless-offline:
httpPort: 3000host: 0.0.0.0 provider:
name: awsruntime: nodejs18.xfunctions:
myFunc:
handler: src/alb.myFuncevents:
- alb:
listenerArn: <some value, probably not important>priority: <some other value, probably not important>conditions:
host: <host>path: /api/*method:
- POST
- GET
Expected behavior/code
When I run sls offline I expect there to be two listeners on the /{stage}/api path but instead I only get one i.e.
What I currently see:
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ POST | http://0.0.0.0:3003/dev/api/{0} │
│ POST | http://0.0.0.0:3003/2015-03-31/functions/myFunc/invocations │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
What I was expecting to see:
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ POST | http://0.0.0.0:3003/dev/api/{0} │
│ GET | http://0.0.0.0:3003/dev/api/{0} │
│ POST | http://0.0.0.0:3003/2015-03-31/functions/myFunc/invocations │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
a possible solution would be to not select the first method but keep the methods as an array then iterate through each to create an hapiHandler and route
I don't currently have time to make a PR but if no one else can I can come back to this when time permits.
The text was updated successfully, but these errors were encountered:
apokryfos
pushed a commit
to apokryfos/serverless-offline
that referenced
this issue
Mar 28, 2024
Bug Report
The ALB event documentation allows specifying multiple methods. However if I try to run my configuration using serverless-offline, only the top method is used.
Current Behavior
Sample Code
Expected behavior/code
When I run
sls offline
I expect there to be two listeners on the /{stage}/api path but instead I only get one i.e.What I currently see:
What I was expecting to see:
Environment
serverless
version: [e.g. v3.28.1]serverless-offline
version: [e.g. v13.3.3]node.js
version: [e.g. v18.19.1]OS
: Ubuntu 22.04.4Possible Solution
The issue seems to be at https://github.com/dherault/serverless-offline/blob/master/src/events/alb/HttpServer.js#L297 where the method is selected as
a possible solution would be to not select the first method but keep the methods as an array then iterate through each to create an hapiHandler and route
I don't currently have time to make a PR but if no one else can I can come back to this when time permits.
The text was updated successfully, but these errors were encountered: