I'm trying to use Prisma to connect to an AWS RDS ...
# orm-help
s
I'm trying to use Prisma to connect to an AWS RDS instance with no public IP (only available on the VPC) and requires SSL. When we do a
prisma db pull --schema <our schema file with connection string>
it connects and sees the database tables and works. When we try to start up the app (which runs fine against local copies of the database) with the same connection string we get error logs of
Copy code
UnhandledPromiseRejectionWarning: Error: Can't reach database server at `<our.rds.instance>.<http://rds.amazonaws.com|rds.amazonaws.com>`:`3600`
This is the format of our connection string.
Copy code
mysql://<user>:<pass>@<our.rds.instance>.<http://rds.amazonaws.com:3306/<database>?pool_timeout=10&connect_timeout=10&sslcert=<ourcert.pem|rds.amazonaws.com:3306/<database>?pool_timeout=10&connect_timeout=10&sslcert=<ourcert.pem>>
Could not having a public IP be causing a connection issue in the Rust code? It's not even getting to the "Authentication failed" which is what happens if I leave off the sslcert when doing a db pull.
@Jason Kleinberg works with me and I'm adding more detail to his question above. Thanks @Ruben Amendoeira for replying to that.
We are running the code inside an ECS instance to which we can manually connect.
j
An extra detail, we are creating our client passing the connection string to the constructor like so:
Copy code
const prisma = new PrismaClient({
  datasources: {
    db: { url: CONNECTION_STRING }
  }
})
UPDATE: If we just call PrismaClient constructor without arguments and the connections url set in the schema, it works. Since we need to connect to multiple databases that share the same topology, we need to be able to create multiple clients, so this is not a solution. It does however point to a possible bug in the constructor.
n
Could you create a Bug Report for this so that our engineering team could further diagnose it?
j
Will do. I looked through the client code, and I couldn’t find an issue.
@Nurul I’m so sorry about this. I hope that no one has spent time investigating this yet. It turned out that our generated connection string transposed numbers in the ports. It was correct in our schema, so of course that worked.
🙌 1
I’m closing the issue.
👍 1
n
Ah, that’s good to know! Sounds good! 👍