Closed Bug 1431546 Opened 8 years ago Closed 7 years ago

fetch_crash_data.py does not handle expired API credentials

Categories

(Socorro :: General, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: osmose, Assigned: willkg)

Details

Attachments

(1 file)

When using the fetch_crash_data script to fetch raw crashes from a server (for bootstrapping the local dev environment, for example), if you use an API key that is expired, the returned crashes contain no info and an `error` key explaining the issue. The script does not detect this, and will save the crashes locally, which can cause issues when writing the fetched crashes to S3 and processing them using the other bootstrapping scripts. Specifically, if undetected, this will result in a PolyStorageError when the processor tries to save the crash to Postgres, claiming that there's no 'submitted_date' key in the crash. To avoid this, the fetch_crash_data script should probably not save crash data when the API returns a permission error due to an invalid/expired API token.
I think it should go one step further--the script should state the API key is expired, the user should either remove the API key from configuration or get a new API key, and then halt. I say that because I'd rather know up front that I need to update my API key and I can't think of a scenario where I'd want the script to continue with a bad API key.
I just hit this, so I'll fix it now.
Assignee: nobody → willkg
Status: NEW → ASSIGNED
Commits pushed to master at https://github.com/mozilla-services/socorro https://github.com/mozilla-services/socorro/commit/1a5082fb0b55b543f3401c875457ede876789943 fix bug 1431546 - raise errors on bad API token If fetch_crash_data is using a bad api token (expired, non-existent, etc) it should raise that as an error and not continue rather than save the error it's getting back from Socorro as the raw crash. This makes that so. https://github.com/mozilla-services/socorro/commit/e95c27daae62c548e31a2fd6bb567b63ea094c95 Merge pull request #4348 from willkg/1431546-expired-key fix bug 1431546 - raise errors on bad API token
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: