I have a serverless.js file that’s my template file and this file get base config from another file, so i want to create a lambda function using typescript i already added the serverless typescript plugin, but every time i try to deploy the function the template doesn’t find my handler file, i think this is due the base config file, but i don’t have any ideia which line is causing this, anyone can help?
module.exports = {
provider: {
name: "aws",
runtime: "nodejs12.x",
stage: "dev",
region: "us-east-2",
timeout: 30,
role: "arn:aws:iam::*****:role/service-role/vpcTeste",
iamRoleStatements: [
{
Effect: "Allow",
Action: ["lambda:InvokeFunction", "lambda:InvokeAsync"],
Resource: "*"
}
],
environment: {
SERVICE_NAME: "${self:service}",
STAGE: "${self:custom.stage}",
JWT_EXPIRATION_TIME: "4320min",
JWT_KEY: "${ssm:jwtKey}",
REGION: "${opt:region, self:provider.region}"
}
},
custom: {
stage: "${opt:stage, self:provider.stage}",
secrets: "${ssm:${self:custom.stage}ApiKey}",
region: "${opt:region, self:provider.region}",
// serverless-plugin-stage-variables
testnet: {
dev: true,
staging: false,
prod: false
},
stageVariables: {
testnet: "${self:custom.testnet.${self:custom.stage}}"
},
// serverless-add-api-key
apiKeys: [
{
name: "${self:custom.stage}ApiKey",
value: "${self:custom.secrets}"
}
],
// Stage domains - serverless-domain-manager
domains: {
prod: "api-lunespay.lunes.io",
staging: "staging-api-lunespay.lunes.io",
dev: "dev-api-lunespay.lunes.io"
},
customDomain: {
basePath: "${self:service}",
domainName: "${self:custom.domains.${self:custom.stage}}",
stage: "${self:custom.stage}",
createRoute53Record: "false"
},
corsOrigins: {
dev: "*",
staging: "*",
prod: "*"
},
// serverless-prune-plugin
prune: {
automatic: true,
number: 2
},
scripts: {
commands: {
serve: 'sls offline start --stage dev --apiKey ${ssm:${self:custom.stage}ApiKey}'
}
}
},
resources: {
Resources: {
RequestValidation: {
Type: "AWS::ApiGateway::RequestValidator",
Properties: {
Name: "request-validation",
RestApiId: {
Ref: "ApiGatewayRestApi"
},
ValidateRequestBody: true,
ValidateRequestParameters: true
}
},
GatewayResponseDefault4XX: {
Type: "AWS::ApiGateway::GatewayResponse",
Properties: {
ResponseParameters: {
"gatewayresponse.header.Access-Control-Allow-Origin": "'*'",
"gatewayresponse.header.Access-Control-Allow-Headers": "'*'"
},
ResponseType: "DEFAULT_4XX",
RestApiId: {
Ref: "ApiGatewayRestApi"
}
}
}
}
},
plugins: [
'serverless-domain-manager',
'serverless-add-api-key',
'serverless-pseudo-parameters',
'serverless-prune-plugin',
'serverless-reqvalidator-plugin',
'serverless-aws-documentation',
'serverless-plugin-stage-variables',
'serverless-plugin-include-dependencies',
'serverless-offline',
'serverless-plugin-scripts'
],
package: {
exclude: ['**'],
individually: true,
excludeDevDependencies: false
}
};