[x] Checked the logs and have provided the logs if I found something suspicious there
I’m submitting a…
[x] Regression (a behavior that stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Documentation issue or request
Current behavior
We use the content API to create and publish data points in one of our schemas. We have a script that deletes the schema, creates it again, and starts filling it with contents.
Recently (the last month to be precise), it started to respond with a 404 Not Found error to a great amount of the content creation requests. All the requests are done to https://cloud.squidex.io/api/content/my-test-app/data/?publish=true with different JSON bodies.
It seems that the error is not related to specific content items because the first time we execute the script, it creates the items, then in the next execution, it starts to fail on some of them. After several retries, it might succeed on the previously failed items and err on other ones.
Expected behavior
The content creation request should not fail with a 404 error if there is no issue in the provided data and request params. Previously we did not experience such behavior.
Minimal reproduction of the problem
In our case it happens after these steps performed by the API:
Create a new schema
Post and publish new contents to the schema (~200 items)
Delete the schema
Again Post and publish the same contents to the schema (~200 items)
It might need another loop of these steps to actually start getting the errors on some of the requests.
I have never experienced this. Perhaps it is an issue with authentication, because it can return a 404 in some scenarios as well so that you cannot try to discover app names.
I see. Has something changed recently in the authentication flow? Because it’s something we haven’t encountered before also.
In the beginning we obtain a token from https://cloud.squidex.io/identity-server/connect/token with squidex-api scope, and use it in all subsequent requests. Strange thing is that after some failures it starts to succeed with the same token. Might it somehow be related to the frequency of the requests or used traffic?
What do you recommend to try or provide for faster resolution?
This is fine. The simplest approach is to reuse the token as long as possible and just retry the request with a new token when you get a 401. But for example if your server is connected to multiple apps and the token is a cached without the app name, it could get mixed up or so.
Well, we obtain a new token on each script execution, so we never get 401. But we do use the same clientId/secret from the owner user account for all of the apps. The scripts for different apps are not executed simultaneously even they do not run during the same day.
Can this be a problem?
Thanks, we use it as we have a lot of apps with the same user and a single script that is used to manage them. Easier to use a single clientId than to generate and manage for each app.
A reference token is a special self contained token, but I have never implemented it and to implement it you have to implement a token store. The default implementation is in-memory, so if you somehow created a reference token, you would perhaps see the 404. Just an idea.
Also as a hint, can it be related to the fact that we perform the auth request several times in subsequent script executions. Like I did 2 auth requests within 5 minutes.
Hey Sebastian. We’re running into something very similar to this. We also use the root user’s credentials, and encounter 404’s that feel extremely random. The difference is that we’re not using Squidex cloud, we run Squidex on-premises. Is there anything we could do about this? Perhaps disable caching, like you did here?