Query error on call

I have a problem
I get error
{
"message": "[function missing(..)] unexpected field 'my.primary.subRouteLevel2' on line:1 col:90 in query '[[at(my.primary.domain, "campaigns")][at(my.primary.subRouteLevel1, "platform")][missing(my.primary.subRouteLevel2)]]'\n[[at(my.primary.domain, "campaigns")][at(my.primary.subRouteLevel1, "platform")][missing(my.primary.subRouteLevel2)]]\n ^\n",
"type": "parsing-error",
"line": 1,
"column": 90,
"id": 0,
"location": "query"
}

Strange is in that I have two similar Types on different repositories (dev/prod) and on dev all work gr8 but on prod get this error

Hey Andrew!

Thanks for posting. Let’s see if we can work through this together.

For starters, I need to look at the code where you’re make your API call. Could you paste that file into a GitHub Gist and post it here? (Make sure not to include any sensitive information.)

Also, could you tell me what technologies you’re using?

Thanks,
Sam

Hey
Here gist https://gist.github.com/imkarmadev/0426594490413248a69f452b9ea303e0

I using JavaScript lib for this

Thx

Hi Andrew,

Thanks for sending along this info!

Sometimes the API returns this error if you have no documents published in the type you’re querying. Do you have any documents published with that type? If not, does it fix the error if you publish one document with the type “primarytest”?

Sam

Hi Sam,
Yes, I publish DOC based on “primarytest” type and have this error.

Stranging in, I have 2 repositories -1st I used for dev env, and when the time come to MVP release, I copy/past custom type json from 1st repo to 2nd, after I create doc and fill with data. And this query good work on 1st repo and throw me error on 2nd =(

if need more info let me know

Thx

Hey Andrew,

I’ve done some investigation, and I might have found the cause of the error.

Can you make sure you have two documents created — one with subRouteLevel2 defined and one without subRouteLevel2 defined? Then test the API call again and let me know if it works?

Sam

Hey Sam

Yes, if create one more doc with filled subRouteLevel2 field then query error gone. :rocket:

For me it looks like a bug on Prismic platform side, and you should create a ticket in your tracker :wink:

Thx you really help

Hey Andrew,

I’m glad that worked! Yes, I agree that this looks like a bug. I’ve submitted an issue to the product team.

Please let me know if you have any more questions :slight_smile:

Sam

I'm having the same issue, though I'm not in a position where I can just create another document of the same type – it's the homepage and it would break our website. For now I'm fetching all documents and filtering client side but it is far from optimal.

https://allaboard.cdn.prismic.io/api/v2/documents/search?q=[[at(document.type%2C+"homepage")]]&q=[[missing(my.homepage.partner)]]&lang=en-gb&fetchLinks=page.title&ref=YjshoxAAAB8AZNUy&integrationFieldsRef=allaboard~581ff474-4057-48a5-b57d-e077d712de9c
{
  "type": "api_parsing_error",
  "message": "[function missing(..)] unexpected field 'my.homepage.partner' on line:1 col:11 in query '[[missing(my.homepage.partner)]]'\n[[missing(my.homepage.partner)]]\n          ^\n",
  "pos": {
    "line": 1,
    "column": 11,
    "id": 1,
    "location": "query"
  }
}