"Unexpected end of JSON input" when requesting an object via client

Hi there!

I'm trying to fetch a single document from Prismic like this:

import smConfig from "../sm.json";
import Prismic from "@prismicio/client";

const Page = (props) => {

  async function queryDoc() {
    const client = Prismic.client(smConfig.apiEndpoint);
    const document = await client.getByUID("foo-type", "abcdef");
    console.log(document);
  }
  queryDoc();

  return <div>Stub</div>;
};

Then I get an error:

I checked network tab, and found out 2 requests spawned. First one to https://<repo>.prismic.io/api/v2 is OK.

But latter is a bit weird:
https://<repo>.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=1&ref=<ref>&q=%5B%5Bat(my.foo-type.uid%2C%20%22abcdef%22)%5D%5D

Why the response could be trimmed like this?

Web-based REST API works fine with a following query:
[at(my.foo-type.uid, "abcdef")]

https://<repo>.prismic.io/api/v2/documents/search?ref=<ref>&q=%5B%5Bat(my.foo-type.uid%2C+%22abcdef%22)%5D%5D#format=html

Hey @Denis,

This is a strange error. Could you tell me your repo name? (Feel free to send it in a DM.)

Is there any chance that your document is exceptionally large or includes any illegal characters?

Sam

Hi Sam,

Sent my repo name to DM. In theory, I could even generate you some temporary access token if it helps, cause my account doesn't contain any sensitive data (yet). And I can always revoke it after the experimentation.