#Using server actions, I get the error "UNABLE_TO_VERIFY_LEAF_SIGNATURE"

1 messages · Page 1 of 1 (latest)

signal wharf
#

All of my actions fail, though they work fine in Postman. I get a 500 everytime.

This is my server action:

  async function getUser(formData: FormData) {
    "use server";
    const cookieStore = cookies();
    const token = cookieStore.get("token");
    const username = formData?.get("username"); // Test username: 9098745

    const res = await fetch(`${process.env.IMIS_URL}/api/User/${username}`, {
      method: "GET",
      headers: {
        Authorization: `Bearer ${token?.value}`,
      },
    });

    const data = await res.json();
    console.log("🚀 ~ data:", data);
  }

And the error I get:

    at async $$ACTION_0 (confirm-your-account/page.tsx:83:17)
Cause: Error: unable to verify the first certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1550:34)
    at TLSSocket.emit (node:events:514:28)
    at TLSSocket._finishInit (node:_tls_wrap:967:8)
    at ssl.onhandshakedone (node:_tls_wrap:743:12)
    at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}```
left micaBOT
#

Hi @signal wharf. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. The information extracts provided do not contain specific details about handling the "UNABLE_TO_VERIFY_LEAF_SIGNATURE" error in Next.js server actions.

This error typically occurs when Node.js is unable to verify the SSL certificate of the server you're trying to connect to. It might be due to a self-signed certificate or a certificate chain issue.

However, without more specific information related to Next.js server actions, it's hard to provide a definitive solution. I recommend checking the official Next.js documentation or the Next.js GitHub issues for more information.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: