I tried to run the basic getting started function from the serverles getting started guide
serverless-offline gives me:
~/NRN/src/new_stack$ sls offline start
Serverless: Starting Offline: dev/us-east-1.
Serverless: Routes for hello:
Type Error ---------------------------------------------
Cannot read property 'toUpperCase' of undefined
This is from a serverless.yml like this:
service: aws-nodejs
functions:
hello:
handler: handler.hello
events:
- http: GET greet
(as per the guide).
When I change it to the longer spec for the http event:
service: aws-nodejs
functions:
hello:
handler: handler.hello
events:
- http:
path: greet
method: GET
it works.
OK. Thanks for reporting. Will need to adjust for RC1.
I looked into this does seem to be because of RC1 representing the different options to describe functions differently in its object model. I will open a ticket with serverless core team to see what if anything they wish to do. Based on that we will take action.
Have not received a response to this issue from serverless team. Still waiting Issue 2178. If you want to add comments there to facilitate a response it would be appreciated.
Done, thanks.
If you want to get this to work in the meantime you can add this:
if(typeof event.http === 'string'){
var split = event.http.split(' ');
event.http = {
path: split[1],
method: split[0],
}
}
Directly after this:
if (!event.http) return;
(line 245 in master right now)
I think we should apply @kajdjakne suggestion for the moment.
Should be fixed in v3.1.0, please confirm :)
Most helpful comment
I looked into this does seem to be because of RC1 representing the different options to describe functions differently in its object model. I will open a ticket with serverless core team to see what if anything they wish to do. Based on that we will take action.