https://serverless-stack.com/ logo
#sst
Title
# sst
p

Pål Brattberg

03/30/2021, 5:43 PM
Hi! Any plans on warning on received, non-valid attributes? I just had a case where I defined my routes like this:
Copy code
'GET /myroute': { authorizationType: sst.ApiAuthorizationType.NONE, function: `services/${id}/timer.opt2`, timeout: 15 }
Of course, that's (mostly) wrong and will ignore the timeout. Now it's defined like this and all is well:
Copy code
'GET /myroute': { authorizationType: sst.ApiAuthorizationType.NONE, function: { handler: `services/${id}/timer.opt2`, timeout: 15 } }
f

Frank

03/30/2021, 6:43 PM
That is annoying and pretty hard to track down.
btw.. you are not using Typescript right?
p

Pål Brattberg

03/30/2021, 7:37 PM
No, but I know I should... 🙂
This would have solved that problem, right? Perhaps starting by just writing my stacks with TS would be a good start!
f

Frank

03/30/2021, 7:39 PM
yeah that would solve it. But I think it’s worth doing some basic validation for JS too… i think the majority still uses JS?
This seems like a common problem.. I’m curious if there are standard ways ppl do attribute validation..
m

Matthew Purdon

04/02/2021, 8:54 PM
We just use typescript and let the linter tell us what’s up
in webstorm it will even auto-generate the required properties for attributes
3 Views