A user (bobpies) encountered a “URL Not Found” error after updating their Discourse forum from 1.6 to 3.1, specifically when calling the /users/by-external/#{user.id} endpoint using the discourse_api gem.
not-ethan suggested that the endpoint changed to /u/by-external/{external_id}.json and requires an API key and username. However, bobpies discovered that the issue was actually due to the updated code throwing an error when no user is found, and they were able to solve it by rescuing the error and updating the response handling.
bobpies also encountered an “Internal server error 500” when calling client.sync_sso, which was caused by a duplicate key value violation in the user_emails table. However, running the same command in the Rails terminal worked fine, suggesting an issue with the API call.
So i’ve been updating my forums from 1.6 to 3.1 which has involved moving to a new server and restoring backup then plugging everything back together
We use SSO for signing into both which still works
However discourse now seems to throw errors in some random areas that is causing a problem with account creation from the website using the API.
We were using the ruby gem discourse_api at version 0.10.1 which i updated to 0.48.1
The error comes at DiscourseApiService.new.user(self)
which calls resp = client.get("/users/by-external/#{user.id}")
which throws the error {"errors"=>["The requested URL or resource could not be found."], "error_type"=>"not_found"}
This used to work fine but now for some reason the URL cannot be found.
I tried downgrading the discourse_api gem to 0.10.1 again which is what we were running previously and it gets past the client.get stage ok but instead fails at the next call with the same error
client.sync_sso(
{"errors"=>["The requested URL or resource could not be found."], "error_type"=>"not_found"}