https://linen.dev logo
MASTRA_STORAGE_POSTGRES_STORE_INIT_FAILED
# 🖥│support-forum
r
Copy code
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'
    }
  }
}
Often getting this error on deploy - I think I have something set up wrong with my memory:
See memory related code here:
Copy code
export 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,
                },
...
u
Hey @rcssdy, could you share more details about your issue. By the error it seems to be an issue with your DB connection which is unrelated to Composio.
r
For context, I am using AWS RDS as my DB provider; and
sslmode=require
I imagine it has something to do with
sslmode=require
so I'm investigating.
u
I might be missing some context. Could you please share a few details on how you’re trying to integrate Composio with your codebase? Also, if there’s a particular function from Composio that’s related to the error, please let me know. Thanks!
r
Sure, so I set
sslmode=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:
Copy code
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.
u
Could you specify how you've integrated Composio?
3 Views