404 when upserting content

I have…

  • [x] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

The api is returning 404 when trying to upsert new documents.
Using PATCH /collection-name/my-custom-id I sometimes get 404.
If I instead use POST /collection-name I get 201. All good.

We can rule out the access token since it works for other application endpoints.

Expected behavior

I would expect to get 200 status code consistently, assuming the body is well formed

Minimal reproduction of the problem

I don’t really how you can reproduce this easily, but I got an example which consistently produces this result. I can share the details with you in private, if you want

Environment

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [x] Cloud version

Hi,

I need concrete and reproducible examples. Not sure what to do with this bug.

This issue looks similar to what these users are experiencing: Random Error 404 when creating content

Could this be the same problem, related to squidex caching?

I’m getting this when trying to create documents for the first time (with that custom id). We also have similar amounts of documents (~200)

But the 404 was solved and the caching is disabled in the cloud. But upserting does not work with the PATCH command, only with POST.

I’m so confused. :frowning_face:

You just told me to use PATCH for this. Upsert replaced document when it exists
And honestly, the documentation says the same: https://cloud.squidex.io/api/content/asap-hub-dev/docs#operation/PatchEventsContent

The data of the content to be created or updated.

Sorry, it was a misunderstanding.

What I meant: When you want to use partial updates you have to use the PATCH endpoint for that, BUT the PATCH endpoint does not make upserts. It is a only an update.

The UPSERT endpoint is basically for import processes, when you have an excel sheet or so and you want to import that. Therefore it does not do partial updates, because it could keep old data in the content.

Thanks, Sebastian, for making this clear. :pray:

I would, again, suggest updating the documentation. Currently the PATCH documentation says it can create documents.

Have already changed that (but not in the cloud).

1 Like