StatementTimeoutException: Request timed out
Hey! So I'm using SST v2 on my project. As database I'm using RDS Aurora (https://v2.sst.dev/databases#rds, https://v2.sst.dev/constructs/RDS) with PostgreSQL engine. I have followed the guide from SST docs and take a look on Drizzle docs too (https://orm.drizzle.team/docs/connect-aws-data-api-pg, https://orm.drizzle.team/docs/perf-serverless). But recently I noticed that I have run into StatementTimeoutException: Request timed out issue. I'm getting this error in SST console:
StatementTimeoutException: Request timed out
at de_StatementTimeoutExceptionRes (file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:62242:21)
at de_CommandError (file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:62064:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:3941:24
at async file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:4160:22
at async file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:7141:42
at async file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:1428:26
at async AwsDataApiPreparedQuery.values (file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:68067:20)
at async AwsDataApiPreparedQuery.execute (file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:68025:20)
at async getAllCommonPermissionsForProfile (file:///var/task/packages/functions/src/api/permissions/get-user-permissions.mjs:76559:28) {
'$fault': 'client',
'$metadata': {
httpStatusCode: 400,
requestId: 'fa1aee17-6111-4aa9-9bd4-d828204809bc',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
dbConnectionId: -1
}
Can someone help me with this? Thank you in advance.Databases | SST v2
Add a serverless database to your SST app.
1 Reply
This is what I have:
// packages/core/drizzle/db.ts
import { RDSDataClient } from '@aws-sdk/client-rds-data'
import { drizzle } from 'drizzle-orm/aws-data-api/pg'
import { RDS } from 'sst/node/rds'
import * as schema from './schema'
const client = new RDSDataClient({})
export const db = drizzle(client, {
database: RDS.db.defaultDatabaseName,
secretArn: RDS.db.secretArn,
resourceArn: RDS.db.clusterArn,
schema,
})
And later on I'm importing this db and use it in lambda handlers and helpers.