Unexpected error on URL when querying Prismic API v2 content in metalsmith?

Hello

I previously posted about running into issue with encountering an Unexpected error on URL when querying Prismic content in metalsmith?](Unexpected error on URL when querying Prismic content in metalsmith?)

I have upgraded our site and our handlebars helpers to use v2 of the api: https://dronedeploy-www.prismic.io/api/v2.

I am now consistency seeing this error again and I'm not sure what is causing this.

Here's the error output:

 [metalsmith-watch] ✓ Live reload server started on port: 3001
Error: Unexpected error on URL https://dronedeploy-www.cdn.prismic.io/api/v2/documents/search?q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%22webinar%22%2C%22event%22%2C%22series%22%2C%22map%22%2C%22trial%22%2C%22solution%22%2C%22story%22%5D)%5D%5D&q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%20%22webinar%22%2C%20%22event%22%2C%20%22series%22%2C%20%22map%22%2C%20%22trial%22%2C%20%22solution%22%2C%20%22story%22%2C%20%22event%22%5D)%5D%5D&page=11&access_token=XXXX&ref=YKLZIREAACIAcvcz
    at ClientRequest.<anonymous> (/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:199:18)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketOnEnd (_http_client.js:453:9)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:39197) UnhandledPromiseRejectionWarning: Error: Unexpected error on URL https://dronedeploy-www.cdn.prismic.io/api/v2/documents/search?q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%22webinar%22%2C%22event%22%2C%22series%22%2C%22map%22%2C%22trial%22%2C%22solution%22%2C%22story%22%5D)%5D%5D&q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%20%22webinar%22%2C%20%22event%22%2C%20%22series%22%2C%20%22map%22%2C%20%22trial%22%2C%20%22solution%22%2C%20%22story%22%2C%20%22event%22%5D)%5D%5D&page=11&access_token=XXXX&ref=YKLZIREAACIAcvcz
    at ClientRequest.<anonymous> (/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:199:18)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketOnEnd (_http_client.js:453:9)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:39197) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:39197) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: Unexpected error on URL https://dronedeploy-www.cdn.prismic.io/api/v2/documents/search?q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22blog_post%22%2C%22story%22%5D)%5D%5D&q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22blog_post%22%2C%20%22story%22%5D)%5D%5D&page=9&access_token=XXXX&ref=YKLZIREAACIAcvcz
    at ClientRequest.<anonymous> (/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:199:18)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:39197) UnhandledPromiseRejectionWarning: Error: Unexpected error on URL https://dronedeploy-www.cdn.prismic.io/api/v2/documents/search?q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22blog_post%22%2C%22story%22%5D)%5D%5D&q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22blog_post%22%2C%20%22story%22%5D)%5D%5D&page=9&access_token=XXXX&ref=YKLZIREAACIAcvcz
    at ClientRequest.<anonymous> (/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:199:18)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:39197) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Error: Unexpected error on URL https://dronedeploy-www.cdn.prismic.io/api/v2/documents/search?q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%22webinar%22%2C%22event%22%2C%22series%22%2C%22map%22%2C%22trial%22%2C%22solution%22%2C%22story%22%5D)%5D%5D&q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%20%22webinar%22%2C%20%22series%22%2C%20%22map%22%2C%20%22solution%22%2C%20%22story%22%5D)%5D%5D&page=11&access_token=XXXX&ref=YKLZIREAACIAcvcz
    at ClientRequest.<anonymous> (/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:199:18)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:39197) UnhandledPromiseRejectionWarning: Error: Unexpected error on URL https://dronedeploy-www.cdn.prismic.io/api/v2/documents/search?q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%22webinar%22%2C%22event%22%2C%22series%22%2C%22map%22%2C%22trial%22%2C%22solution%22%2C%22story%22%5D)%5D%5D&q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%20%22webinar%22%2C%20%22series%22%2C%20%22map%22%2C%20%22solution%22%2C%20%22story%22%5D)%5D%5D&page=11&access_token=XXXX&ref=YKLZIREAACIAcvcz
    at ClientRequest.<anonymous> (/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:199:18)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:39197) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
/Users/nikibrown/Code/landing_page/node_modules/metalsmith-prismic-server/src/dev-server.js:29
        throw err;
        ^

Error: Unexpected error on URL https://dronedeploy-www.cdn.prismic.io/api/v2/documents/search?q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%22webinar%22%2C%22event%22%2C%22series%22%2C%22map%22%2C%22trial%22%2C%22solution%22%2C%22story%22%5D)%5D%5D&q=%5B%5B%3Ad%20%3D%20any(document.type%2C%20%5B%22ebook%22%2C%20%22webinar%22%2C%20%22event%22%2C%20%22series%22%2C%20%22map%22%2C%20%22trial%22%2C%20%22solution%22%2C%20%22story%22%2C%20%22event%22%5D)%5D%5D&page=11&access_token=XXXX&ref=YKLZIREAACIAcvcz
    at ClientRequest.<anonymous> (/Users/nikibrown/Code/landing_page/node_modules/prismic.io/lib/requests.js:199:18)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketOnEnd (_http_client.js:453:9)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! DroneDeploy@1.0.0 dev: `node metalsmith.js dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the DroneDeploy@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/nikibrown/.npm/_logs/2021-05-17T21_11_56_903Z-debug.log

Any help is greatly appreciated.

Thanks,

Niki Brown

Pinging again on this. I am not able to run my site locally at all due to this error. It looks like the error is coming from the prismic.io javascript kit here: javascript-kit/requests.js at master · prismicio/javascript-kit · GitHub

Thanks!

  • N

Hey @niki.brown, I hope you're doing great!

I remember you were using Gatsby in your project; is it the same?
I'm not sure what can be causing this error. If you want, send me your project and steps to run it via dm, and we can try and debug this together.

Hi @Pau Our site runs metalsmith and you did investigate the same issue with the V1 api. I will give you access to our private git repo again.

Thanks!

@Pau What is your github username?

@niki.brown is pvpg,
Thanks!

Hi @Pau you should have access now. I will send you a private message with our prismic token.

Hi @Pau Can you let me know if you were able to pull the repo and get things running? I sent the token in a private message.

Thanks,

N

Hi @Pau Following up on this again as its been a week. This is a pretty big blocking issue for us. Again the issue seems to be the prismic.io node module. Do you have an ETA when you or your team would be able to take a look?

Thanks!

Hey @niki.brown, we're now taking a look at your project; I sent you a private message, as we need some guidance in trying to reproduce the issue.

Thanks

The conversation for this use case has continued in a direct message.