Next.js Discord

Discord Forum

can't resolve UNABLE_TO_VERIFY_LEAF_SIGNATURE

Answered
West African Lion posted this in #help-forum
Open in Discord
West African LionOP
⨯ TypeError: fetch failed
    at async ProductView (file://.../app/product-view/%5Bid%5D/page.tsx:28:25)
  [cause]: [Error: unable to verify the first certificate] {
    code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
  }
}
 GET /product-view/2 500 in 2856ms

    let productInfoRes = await fetch(`${API_URL}/product/${(await params).id}`);

.env.local
NODE_ENV=development
NODE_EXTRA_CA_CERTS="C:\Users\SID\AppData\Local\mkcert\rootCA.pem"
Answered by West African Lion
works with --experimental-https
View full answer

8 Replies

West African LionOP
also for note I am accessing site through nginx reverse proxy
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

    server {
        listen 443 ssl;
        server_name dev.computers.baosis.com;

        ssl_certificate     ssl/<cert file>;
        ssl_certificate_key ssl/<key file>;

        location / {
            proxy_pass http://127.0.0.1:3000;
        }

        location /_next/webpack-hmr {
            # not important for this
        }
    }

    server {
        listen 443 ssl;
        server_name api.dev.computers.baosis.com;

        ssl_certificate     ssl/<cert file>;
        ssl_certificate_key ssl/<key file>;

        location / {
            proxy_pass http://127.0.0.1:8000;
        }
    }
also I am using fastapi to serve images
@app.get("/product/{_id}")
def get_product_info(_id: int) -> dict:
    data = dbmgr.retrieve_product(_id)
    if data:
        return data

    raise HTTPException(404, "product not found")
West African LionOP
I am using Next.js 15.2.3 with Turbopack
West African LionOP
ping me on reply
West African LionOP
also forgot to mention fastapi doesn't receive any request
West African LionOP
I realized that this happens in server components
West African LionOP
works with --experimental-https
Answer