Not records found in production after deploy

Finally I fixed the issue by writing a converter from database uri to connection object :slight_smile:

if (process.env.FOREST_AUTH_SECRET && process.env.FOREST_ENV_SECRET) {
    // TO FIX ISSUE WITH FOREST WHO USE `use` old syntax
    await fastify.register(require('@fastify/middie'));

    const url = new URL(process.env.DATABASE_URL!);
    const connectionObject = {
      dialect: url.protocol.split(':')[0],
      database: url.pathname.split('/')[1],
      username: url.username,
      password: url.password,
      host: url.hostname,
      port: url.port ? parseInt(url.port, 10) : undefined,
      schema: url.searchParams.get('schema') || undefined,
    };

    await createAgent({
      authSecret: process.env.FOREST_AUTH_SECRET!,
      envSecret: process.env.FOREST_ENV_SECRET!,
      isProduction: process.env.NODE_ENV === 'production',
      typingsPath: './typings.ts',
      typingsMaxDepth: 5,
      prefix: 'forestadmin',
    })
      //@ts-ignore
      .addDataSource(createSqlDataSource(connectionObject))
      .mountOnFastify(fastify)
      .start();
  }```
2 Likes