iandees / wof-editor

A simple Who's on First editor.
https://writefield.nextzen.org/
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

500 Internal Server Error when proposing change #53

Closed stepps00 closed 3 years ago

stepps00 commented 3 years ago

I'm getting a 500 Internal Server Error when trying to propose changes to GitHub. I can repro this 100% of the time, steps to repro:

  1. Login to the write-field editor
  2. Load record by id: 1209170307
  3. Update the wof:name
  4. Click the "Propose Change on GitHub" button
  5. See error
stepps00 commented 3 years ago

Another id that results in the same error: 1209746607.

iandees commented 3 years ago

Log says:

Exception on /place/edit [POST]
Traceback (most recent call last):
  File "/var/task/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/var/task/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/var/task/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/var/task/flask/_compat.py", line 39, in reraise
    raise value
  File "/var/task/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/var/task/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/var/task/editor/place/views.py", line 551, in edit_place
    'https://api.github.com/repos/%s/git/blobs' % (write_repo,),
UnboundLocalError: local variable 'write_repo' referenced before assignment
iandees commented 3 years ago

@stepps00 I think this might mean the feature doesn't have a wof:repo attribute?

iandees commented 3 years ago

Nah, it's there. It's probably a bug in the code. I'll take a look tomorrow.

iandees commented 3 years ago

It looks like the issue is that the whosonfirst Github organization hasn't authorized the WOF Editor OAuth app and the API is preventing the app from creating branches.

If you have admin access to the org, you should have gotten an email now when I requested it. If not, maybe need to ping Aaron.

iandees commented 3 years ago

I did add some checks in 574cbd6 that should give a graceful error instead of a 500, but it's kind of hard to test this.

iandees commented 3 years ago

I was able to make a PR (https://github.com/whosonfirst-data/whosonfirst-data-admin-in/pull/65) for the example in the description. Are you still having problems?

stepps00 commented 3 years ago

Hmm, yeah I'm still hitting the same 500 error using the repro steps above.

I'm not an admin in the whosonfirst-data org, so it sounds like Aaron may need to grant privileges.