404 when trying to create an API key for system user

AI-generated summary

A user, OnceWas, is experiencing a 404 error when trying to generate an API key for the ‘system’ user in Discourse v1.4.0.beta9. The issue is not present when generating API keys for other users. sam suggests a workaround: generating a global key and passing the username “system” with the API call. This approach has been confirmed to work by blake, who notes that it’s also possible to select the “system” user and generate a key specifically for it.

I am trying to create an API key for our ‘system’ user. When I click on Generate from the system user’s admin page, I get no key, and a 404 error appears in the console. There is no entry in the Discourse log.

https://<site_url>/admin/users/-1/generate_api_key Failed to load resource: the server responded with a status of 404 (Not Found)

I am able to generate API keys for other users.

I am running v1.4.0.beta9.

Can we repro this @sam? Could be legit.

It looks like a routing bug but has a very easy workaround.

Generate a global key and just pass the username system with the API call.

3 Mi Piace

Questo funziona effettivamente ora. Pensavo che si dovesse utilizzare l’opzione “tutti gli utenti”, ma ora è possibile selezionare anche “sistema” come utente e generare una chiave solo per l’utente di sistema.

3 Mi Piace