Pål Brattberg
03/01/2021, 7:09 PMsst.Api and one thing that I noticed was different is that I get a notice of the following for each route:
Transpiling Lambda code...
No package.json found in services/mobile-api/
No package.json found in services/mobile-api/
Debug session started. Listening for requests...
I do not see this while defining sst.Function s.
Note: I use a single package.json in my root folder and many services below this, like ./services/a, ./services/b, ./services/cFrank
srcPath is set to services/mobile-api for the routes in your Api?Pål Brattberg
03/01/2021, 7:12 PMFrank
srcPath set to when you were defining sst.Function?Pål Brattberg
03/01/2021, 7:13 PMdefaultFunctionProps: {
srcPath: `services/${id}/`
},Pål Brattberg
03/01/2021, 7:13 PMhandler attributeFrank
Pål Brattberg
03/01/2021, 7:15 PMFrank
services/${id}/lambda.mainPål Brattberg
03/01/2021, 7:16 PMPål Brattberg
03/01/2021, 7:20 PMthis.api = new sst.Api(this, 'Api', {
domain: '<http://mydomain.com|mydomain.com>',
defaultFunctionProps: {
srcPath: `services/${id}/`
},
routes: {
'GET /mobile-api/ping2': 'handler.ping',
'GET /mobile-api/ping3': {
authorizationType: sst.ApiAuthorizationType.AWS_IAM,
function: 'handler.securePing'
}
}
})
Second version works and gives no warning:
this.api = new sst.Api(this, 'Api', {
domain: '<http://mydomain.com|mydomain.com>',
routes: {
'GET /mobile-api/ping2': `services/${id}/handler.ping`,
'GET /mobile-api/ping3': {
authorizationType: sst.ApiAuthorizationType.AWS_IAM,
function: `services/${id}/handler.securePing`
}
}
})Pål Brattberg
03/01/2021, 7:21 PMsrcPath does more than just common prefix for handlers if I understand correctlyJay
Jay
bundle option, the srcPath isn't useful.Pål Brattberg
03/01/2021, 7:23 PMJay
Jay