When we duplicate certain documents the endpoint returns error

When we duplicate some documents all the API crashes and our site stops working as no document is fetched from the endpoint.

If we archive those documents the API works again.

Any clue?

1 Like

Hi Miguel,

Welcome to the community!

I'm sorry to hear you're having these issues.

Can you send any screenshots of the errors you're seeing? Also can you check what errors you're seeing in the browser console?

Then can you send me your repo URL so we can investigate this on our side? (You can send it to me in a private message if you want, just click my profile image.)

Thanks.

Hi again Miguel,

I checked our logs and wasn't able to find errors for your repository.

I also made a duplicate to try and recreate the issue, but could not.

The only thing that I don't really understand is why all these [object%20Object]%2C codes are being passed in to your language code parameter lang=? When I passed this to my own query string I got the following error expectedly:
"message": "Some([object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]) isn't a valid language id
}"

Once I removed this and gave a normal language wildcard code like lang=* the query worked.

How are you passing the master ref to your queries? Are you caching this?

Thanks.

Hi Phil,

We managed to figure out what happened (or we guess so).

The problem was we were duplicating documents and probably those slugs we were using were being used in other archived documents.

We cleaned completely our archive and now it seems fine when we duplicate docs.

Regarding the [object%20Object]%2C : I just copied the response I got from the API. We are using your JS library so I have no clue what is happening under the hood.

An example of what we are using is:
return Prismic.getApi(apiEndpoint, {accessToken: accessToken}).then((api) => {
return api.query(Prismic.Predicates.at('document.type', homepageType),
{ lang: lang, pageSize: 100 })
}).then(response => response.results)

What that builds under the hood to concatenate all those objects... no idea.
We are using an old version of you library which I'll try to update soon.

Thanks for your time.
Cheers.

1 Like

Hey again Miguel,

I'm glad you figured this out, it seems like a weird bug that I haven't seen before. Maybe it might be related to the old version of the Kit like you said.

Anyway, let me know if you see anything like this in the future.

Thanks.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.