FetchError: request to REPONAME failed, reason: unable to get local issuer certificate

Hi Prismic Team - I'm trying to run my site locally and ran into a new error when I run npm run dev

error - FetchError: request to https://dronedeploy-www.cdn.prismic.io/api/v2 failed, reason: unable to get local issuer certificate

I recently upgraded my site to use prismicio/client and have my reponame set as const endpoint = prismic.getEndpoint("dronedeploy-www") My repo is set up to be public: Public API for Master only - Require an access token to preview future releases

This was correctly querying my content from the API last week. In between last week and today nothing changed.

Thanks,

Niki

I'm also running into a similar issue with the old version of our site that runs on metalsmith with initializing the API. Which makes me think something is wrong with our prismic repo.

Loaded .env file...
{
  AWS_ACCESS_KEY_ID: '',
  AWS_SECRET_ACCESS_KEY: '',
  PRISMIC_URL: 'https://dronedeploy-www.prismic.io/api/v2',
  PRISMIC_TOKEN: 'XXXX',
  CIRCLE_BRANCH: 'master'
}


BRANCH NAME: master
Could not initialize API: Error: Unexpected error on URL https://dronedeploy-www.prismic.io/api/v2?access_token=xxxx
/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:202
        callback(new Error("Unexpected error on URL "+requestUrl), null, err);
                 ^

Error: Unexpected error on URL https://dronedeploy-www.prismic.io/api/v2?access_token=xxxx
    at ClientRequest.<anonymous> (/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:202:18)
    at ClientRequest.emit (node:events:390:28)
    at TLSSocket.socketErrorListener (node:_http_client:447:9)
    at TLSSocket.emit (node:events:390:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Hi @niki.brown,

Thanks for reaching out.

I will try to investigate this issue with you; it seems that retrieving your master ref data is fine using API directly, as shown here.

This issue might be linked to your Prismic token, but it all depends for me on what content you are trying to fetch (master or a release) when you run npm run dev

To further investigate this issue, I would need some more information about the exact request that is failing otherwise, you can share the code with me in a private message, and I will try to debug it,

Looking to your reply,
Fares

@Fares The issue turned out to be caused by Cloudflare Warp client blocking my API calls from terminal. Lol so much lost time! Thanks for your help.

1 Like