Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the 500 server error when the multisite-accounts plugin misses a master API key #223

Open
tanius opened this issue Oct 26, 2019 · 1 comment
Assignees

Comments

@tanius
Copy link
Member

tanius commented Oct 26, 2019

The relevant line of code that will lead to the "500 Internal Server Error" crash is this one.

It happens in case of a request to multisite_account.json that includes a request for an API key for a site for which Discourse does not know the master API key, so cannot find it in the line of code referenced above.

The Discourse error log in the admin backend has this about the crash:

NoMethodError (undefined method `[]' for nil:NilClass) in 
[…]/plugins/edgeryders-multisite-accounts/plugin.rb:97:in `create_community_account'

stacktrace (most recent first): 

[…]/plugins/edgeryders-multisite-accounts/plugin.rb:97:in `create_community_account' 
[…]/plugins/edgeryders-multisite-accounts/plugin.rb:53:in `block in create' 
[…]/plugins/edgeryders-multisite-accounts/plugin.rb:52:in `map' 
[…]/plugins/edgeryders-multisite-accounts/plugin.rb:52:in `create'
@tanius
Copy link
Member Author

tanius commented Jun 25, 2020

The same "500 server error" response happens for:

  • Requests to API endpoint multisite_account.json?hostname=… with a hostname parameter that is not even an Edgeryders Communities site, including hostnames that do not even resolve by DNS.

  • Requests to the second API endpoint multisite_account_api_key.json?hostname=… with a hostname parameter for which Discourse does not know the master API key in order to determine or create the requested API key. Tested with user matthias and hostname forum.burning-stories.org.

  • Requests to the second API endpoint multisite_account_api_key.json?hostname=… with a hostname parameter that is not even an Edgeryders Communities site, including hostnames that do not even resolve by DNS.

In all of these cases, the server should return an appropriate status code that is not 500 and a suitable error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants