MSD-LIVE / issues

0 stars 0 forks source link

handle/log when drafts fail to be created #195

Open zguillen opened 4 months ago

zguillen commented 4 months ago

I'm seeing this on prod, I can't explain why it happened/happens but lets handle it better and add some logging:

msdlive-rdm-app/assets/js/invenio_app_rdm/msdlive_components/modals/MsdliveNewUploadModal.js

in createRecord = async (fileLocation) => {

the id from:

    try {
      const resp = await this.axios.post("/records", prunedRecord);
      const parsedResponse = resp.data;
      return parsedResponse.id;
    } catch (error) {
      console.error(error);
    }

is 'undefined' but no error is thrown and so the next request is made to add the record to the community and the URL looks like: https://data.msdlive.org/api/records/undefined/draft/review

and THAT causes an error to be thrown.

Add some checks in that try block to make sure it has an ID and if not show an error message to the user and ask them to try again. I

see: https://pnnl-l9.sentry.io/issues/5142392335/events/d0a524a1e2e540ae88f1fe2a1e5c56b7/