P
Prisma2mo ago
Felipe

[FIXED] Error when providing certificate

I'm passing the certificate in the url, but it doesn't work. My project tree is this:
├── src
│ ├── infra
│ │ ├── db
│ │ │ ├── prisma
│ │ │ │ ├── schema
│ │ │ │ │ ├── prisma.schema
│ │ │ │ ├── cert
│ │ │ │ │ ├── global-bundle.pem
├── src
│ ├── infra
│ │ ├── db
│ │ │ ├── prisma
│ │ │ │ ├── schema
│ │ │ │ │ ├── prisma.schema
│ │ │ │ ├── cert
│ │ │ │ │ ├── global-bundle.pem
I entered the file address in several ways, referring to the Prisma folder, but without success. sslcert=global-bundle.pem sslcert=./cert/global-bundle.pem sslcert=../cert/global-bundle.pem Can someone help me?
Solution:
I added the file to the NestJS CLI assets configuration and decided to test the full path in the dist folder (sslcert=/app/dist/infra/db/prisma/cert/global-bundle.pem) and it worked.
Jump to solution
4 Replies
Felipe
Felipe2mo ago
Note: On localhost it works normally, the problem is when it goes to the pipeline.
jonfanz
jonfanz2mo ago
What db engine are you using?
Felipe
Felipe2mo ago
@Jon Harrell I use Postgres 15 on AWS RDS. It works on localhost, with a Docker image, but when I upload it to the AWS development environment, it shows this error: Error opening a TLS connection: cert file not found Hi @jonfanz! I believe I discovered the issue: NestJs was not including the .pem file in the application build. I added a script to make this copy, but I still haven't been able to make it work.
#25 [linux/amd64 builder 9/12] RUN npm run generate:prisma
#25 0.292
#25 0.292 > api@1.0.0 generate:prisma
#25 0.292 > prisma generate
#25 0.292
#25 1.007 Environment variables loaded from .env
#25 1.010 Prisma schema loaded from src/infra/db/prisma/schema/schema.prisma

#26 [linux/amd64 builder 10/12] RUN npm run build
#26 0.349
#26 0.349 > api@1.0.0 build
#26 0.349 > nest build
#26 0.349
#26 ...

#26 [linux/amd64 builder 10/12] RUN npm run build
#26 13.07
#26 13.07 > api@1.0.0 postbuild
#26 13.07 > shx cp -r src/infra/db/prisma/cert dist/infra/db/prisma
#26 13.07
#26 ...
#25 [linux/amd64 builder 9/12] RUN npm run generate:prisma
#25 0.292
#25 0.292 > api@1.0.0 generate:prisma
#25 0.292 > prisma generate
#25 0.292
#25 1.007 Environment variables loaded from .env
#25 1.010 Prisma schema loaded from src/infra/db/prisma/schema/schema.prisma

#26 [linux/amd64 builder 10/12] RUN npm run build
#26 0.349
#26 0.349 > api@1.0.0 build
#26 0.349 > nest build
#26 0.349
#26 ...

#26 [linux/amd64 builder 10/12] RUN npm run build
#26 13.07
#26 13.07 > api@1.0.0 postbuild
#26 13.07 > shx cp -r src/infra/db/prisma/cert dist/infra/db/prisma
#26 13.07
#26 ...
I tried to use these two ways, but unsuccessful: sslcert=./cert/global-bundle.pem sslcert=../cert/global-bundle.pem Any idea?
Solution
Felipe
Felipe2mo ago
I added the file to the NestJS CLI assets configuration and decided to test the full path in the dist folder (sslcert=/app/dist/infra/db/prisma/cert/global-bundle.pem) and it worked.