prisma1 icon indicating copy to clipboard operation
prisma1 copied to clipboard

unable to verify the first certificate

Open Gujie-Novade opened this issue 7 years ago • 2 comments

Describe the bug Cannot use prisma deploy to update a remote server. The error message is: environment FetchError: request to https://myserver/management failed, reason: unable to verify the first certificate

To Reproduce Steps to reproduce the behavior:

  1. Setup an Ubuntu VM 16.04
  2. Setup nginx as a reverse proxy to redirect traffic to prisma server (see config file)
  3. Setup prisma server following the tuto 1.25 for Mongodb with docker
  4. On your local machine, create datamodel.prisma and prisma.yml
  5. Run prisma deploy

Expected behavior I was expecting prisma to deploy the schema on the remote server

Versions (please complete the following information):

  • Connector: MongoDB
  • Prisma Server: 1.25.0
  • prisma CLI: [e.g. prisma/1.25.3 node-v10.4.0]
  • OS: Windows 10

Additional context I checked the management endpoint was ok by going to https://myserver/management on my browser. It may be related to #2852

/etc/nginx/sites-enabled/default (on Ubuntu 16.04)

server {
        # SSL configuration
        listen 443 ssl default_server;
        listen [::]:443 ssl default_server;
        ssl_certificate /etc/nginx/ssl/cert.crt;
        ssl_certificate_key /etc/nginx/ssl/certPrivate.rsa;

        server_name myserver;

        # Prisma Server
        location / {
                proxy_pass http://localhost:4466;
        }
}

prisma.yml (on Windows 10)

# The HTTP endpoint for your Prisma API
endpoint: https://myserver/myservice/dev

# Points to the file that contains your datamodel
datamodel: datamodel.prisma

# Specifies language & location for the generated Prisma client
generate:
  - generator: javascript-client
    output: ../src/generated/prisma-client

Gujie-Novade avatar Jan 25 '19 08:01 Gujie-Novade

Looks like either your certificate is self-signed or you are missing proper root CA.

Can you confirm that you are able to use a reverse proxy for a simple nodejs app? It is not related to prisma and you should properly check your TLS config of nginx. You can also try installing some root CAs.

I will recommend you to try let's encrypt to get a certificate for free to test this out. Here is a good tutorial for that: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04

pantharshit00 avatar Jan 25 '19 10:01 pantharshit00

No it's not a self-signed certificate. I've got other node apps running on the same server on different port and I can access them fine via nginx. (I had removed them from the config file for clarity).

If you think it's not an issue with prisma I'll close this issue and debug on my own.

Gujie-Novade avatar Jan 25 '19 10:01 Gujie-Novade