Michael Poulgrain
05/09/2022, 5:28 PMERROR Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'filename')
Michael Poulgrain
05/09/2022, 5:32 PMconst dataSource = new DataSource({
type: "aurora-postgres",
region: "eu-central-1",
logging: true,
database: process.env.DB_NAME || "",
secretArn: process.env.CLUSTER_SECRET_ARN || "",
resourceArn: process.env.CLUSTER_ARN || "",
// entities: [TestModel],
});
and my GraphqlApi is as follows:
const api = new sst.GraphQLApi(this, "Api", {
server: {
handler: "src/graphql.handler",
timeout: 3,
},
defaults: {
function: {
environment: {
DB_NAME: DATABASE,
CLUSTER_ARN: cluster.clusterArn,
CLUSTER_SECRET_ARN: cluster.secretArn,
},
},
},
});
and my dependencies are also as follows:
"devDependencies": {
"@serverless-stack/cli": "1.0.2",
"@serverless-stack/resources": "1.0.2",
"@tsconfig/node14": "^1.0.1",
"@types/aws-lambda": "^8.10.70",
"@types/bcrypt": "^5.0.0",
"@types/data-api-client": "^1.2.4",
"@types/luxon": "^2.3.2",
"@types/node": "<15.0.0",
"aws-cdk-lib": "2.20.0",
"typescript": "^4.6.4"
},
"dependencies": {
"apollo-server-lambda": "^3.7.0",
"bcrypt": "^5.0.1",
"class-validator": "^0.13.2",
"data-api-client": "^1.3.0",
"graphql": "^15.3.0",
"graphql-scalars": "^1.17.0",
"graphql-upload": "^13.0.0",
"hcaptcha": "^0.1.1",
"jsonwebtoken": "^8.5.1",
"luxon": "^2.3.2",
"type-graphql": "^1.1.1",
"typeorm": "^0.3.6",
"typeorm-aurora-data-api-driver": "^2.4.2"
}
Adam Fanello
05/09/2022, 5:41 PMMichael Poulgrain
05/09/2022, 6:02 PM@anatine/esbuild-decorators
as follows but am still receiving the same issue.
Api Stack:
const api = new sst.GraphQLApi(this, "Api", {
server: {
handler: "src/graphql.handler",
timeout: 3,
},
defaults: {
function: {
bundle: {
esbuildConfig: {
plugins: "config/esbuild.js",
},
},
environment: {
DB_NAME: DATABASE,
CLUSTER_ARN: cluster.clusterArn,
CLUSTER_SECRET_ARN: cluster.secretArn,
},
},
},
});
config/esbuild.js:
const { esbuildDecorators } = require("@anatine/esbuild-decorators");
module.exports = [esbuildDecorators()];
Adam Fanello
05/09/2022, 6:03 PMMichael Poulgrain
05/09/2022, 6:07 PMFrank
Frank