rcssdy
11/02/2025, 4:56 PMError: self-signed certificate in certificate chain
at O.init (.next/server/chunks/5526.js:362:1871) {
id: 'MASTRA_STORAGE_POSTGRES_STORE_INIT_FAILED',
domain: 'STORAGE',
category: 'THIRD_PARTY',
details: {},
[cause]: Error: self-signed certificate in certificate chain
at I.createTable (.next/server/chunks/5526.js:267:161)
at async O.init (.next/server/chunks/5526.js:362:74181)
at async O.init (.next/server/chunks/5526.js:362:1726) {
id: 'MASTRA_STORAGE_PG_STORE_CREATE_TABLE_FAILED',
domain: 'STORAGE',
category: 'THIRD_PARTY',
details: { tableName: 'mastra_workflow_snapshot' },
[cause]: [Error: self-signed certificate in certificate chain] {
code: 'SELF_SIGNED_CERT_IN_CHAIN'
}
}
}
Often getting this error on deploy - I think I have something set up wrong with my memory:rcssdy
11/02/2025, 4:57 PMexport const tracingStore = new PostgresStore({
connectionString: process.env.DATABASE_URL!,
ssl:
process.env.NODE_ENV === "production"
? { rejectUnauthorized: false }
: false,
max: 5,
idleTimeoutMillis: 30000,
})
/**
* Memory storage instance
* Shared across all agents to avoid duplicate database connections
*/
const memoryStore = new PostgresStore({
connectionString: process.env.DATABASE_URL!,
ssl:
process.env.NODE_ENV === "production"
? { rejectUnauthorized: false }
: false,
max: 5,
idleTimeoutMillis: 30000,
})
/**
* Vector storage instance
* Shared across all agents for semantic recall
*/
const vectorStore = new PgVector({
connectionString: process.env.DATABASE_URL!,
ssl:
process.env.NODE_ENV === "production"
? { rejectUnauthorized: false }
: false,
max: 5,
idleTimeoutMillis: 30000,
})
/**
* Singleton Memory instance
* Reused across all agents to avoid duplicate database connections
*/
let memoryInstance: Memory | null = null
/**
* Get or create the shared Memory instance
* This ensures only one Memory instance is created per application lifecycle
*/
export function createMemory(): Memory {
if (!memoryInstance) {
memoryInstance = new Memory({
storage: memoryStore,
vector: vectorStore,
embedder: openai.embedding("text-embedding-3-small"),
options: {
lastMessages: 10,
semanticRecall: {
topK: 3,
messageRange: 2,
scope: "resource", // Search across all threads for this user
},
workingMemory: {
enabled: true,
scope: "resource", // Resource = user-specific working memory
template: workingMemoryTemplate,
},
...Uday
11/02/2025, 9:32 PMrcssdy
11/03/2025, 3:02 PMsslmode=require
I imagine it has something to do with sslmode=require so I'm investigating.Uday
11/03/2025, 4:00 PMrcssdy
11/03/2025, 4:23 PMsslmode=require on my db connection string, and here's what I have currently:
https://gist.github.com/rcssdy/8a95eef881c2e0663b5a4c0f83b57dc3
And this is the error that I ma getting exactly:
Error: self-signed certificate in certificate chain
at O.init (.next/server/chunks/5526.js:362:1871) {
id: 'MASTRA_STORAGE_POSTGRES_STORE_INIT_FAILED',
domain: 'STORAGE',
category: 'THIRD_PARTY',
details: {},
[cause]: Error: self-signed certificate in certificate chain
at I.createTable (.next/server/chunks/5526.js:267:161)
at async O.init (.next/server/chunks/5526.js:362:74181)
at async O.init (.next/server/chunks/5526.js:362:1726) {
id: 'MASTRA_STORAGE_PG_STORE_CREATE_TABLE_FAILED',
domain: 'STORAGE',
category: 'THIRD_PARTY',
details: { tableName: 'mastra_workflow_snapshot' },
[cause]: [Error: self-signed certificate in certificate chain] {
code: 'SELF_SIGNED_CERT_IN_CHAIN'
}
}
}
Above is the memory configuration, I am using a PostgresStore as you can see; and that is the source of the error. I believe it is something to do with the SSL cert / AWS RDS setup - so I got the .pem from AWS directly and I'm loading it above.
Not sure if that's everything, but it's directly related to the memory configuration / PostgresStore.Uday
11/03/2025, 7:13 PM