CDLUC3 / dmptool

DMPTool version of the DMPRoadmap codebase
https://dmptool.org
MIT License
56 stars 13 forks source link

Error on UofColorado-Boulder's upload page #566

Closed magicalmary closed 1 month ago

magicalmary commented 2 months ago

As an administrator member of the University of Colorado Boulder institution, the 'Upload Plan' page shows an error message and does not allow you to proceed.

To Reproduce Steps to reproduce the behavior:

  1. Login to DMP Tool production as a administrator for Boulder.
  2. Click on 'Upload Plan'
  3. Error message is immediately generated: Unexpected Application Error! Cannot read properties of null (reading '1') TypeError: Cannot read properties of null (reading '1') at https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:524271 at Array.map () at fr (https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:524205) at ko (https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:355344) at Ss (https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:366925) at kl (https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:412695) at bu (https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:401080) at gu (https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:401008) at yu (https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:400871) at ou (https://dmptool.org/assets/reactApplication-3d56908fe58519d9f7385e84b4256c12baab99bfb5b5602065ec4bb76978e98c.js:2:397706)

Additional context This is the same user that noted the error when trying to register his uploaded plan, related to not having a repository URL. After I informed him of this, he stated "I just deleted the output we had entered, and tried to complete the upload process again, and this time I got a different error message (see attached screenshot)."

Also, when I change my institution from Boulder to another, the 'Upload Plan' page appears as expected with no error messages.

Screenshot 2024-04-09 at 11 15 46 AM

briri commented 2 months ago

Looks like the user successfully registered a DMP ID but the code is now failing when trying to build the link to the DMP ID landing page on this line.

It's looking for the pages in the draft_data portion of the JSON record but it is either null of does not conform to the DOI regex for some reason. Will investigate and try to get something out with the changes for issue #565

briri commented 2 months ago

Rails is sending the following in the draft_data block to the React page:

{"landing_page"=>"https://doi.org/10.48321/D14F38aa13", "narrative"=>{"file_name"=>"DMP_Calkins_Proposal.pdf", "url"=>"https://dmptool.org//rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBaDBNIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--2e4787779b246e33ab823f9a40ccaf712db9e9b4/DMP_Calkins_Proposal.pdf"}}

Note that in prod, we're using the actual DOIs instead of the server names, so https://doi.org/10.48321/D14F38aa13 instead of https://dmphub.uc3prd.cdlib.net/dmps/10.48321/D14F38aa13 but the regex is looking for the pattern/dmps/ so its failing. I'm not sure what the best solution is. We could I guess check the environment to see if we're in prod but I'm not sure how to do that in JS or maybe we can have it match either /dmps or doi.org/?

@jupiter007 can you check the JS code to see which approach would be the most appropriate?

magicalmary commented 2 months ago

User at Northwestern reports the same issue: "I went back to my saved but not registered plan from yesterday. I removed the outputs and tried to register the plan. I received an error again, visual attached. Hopefully the draft plan is still there, since I can’t move beyond this screen!"

Screenshot of message attached.

Screenshot 2024-04-09 at 2 32 43 PM
briri commented 2 months ago

Yes, the draft plans are still there and it was successfully registered. The error is related to trying to display the DMP ID on that dashboard page. we are working on it and hope to have a fix out this afternoon. @jupiter007 this one is related. If you cannot see the Upload dashboard when you change your affiliation in production, Mary might be able to show you

jupiter007 commented 2 months ago

@magicalmary and @briri,

I created a PR for the bug fix: https://github.com/CDLUC3/dmptool/pull/568

As Brian mentioned, we are extracting the DMP ID for the Uploads table from a property called landingPageUrl by using a regular expression. That regular expression needed to be different for production, since the path is different.

@briri it looks like DockerFile is setting the NODE_ENV for production, so I added a different regEx for when either the hostname = "dmptool.org" or when the NODE_ENV is production.

magicalmary commented 2 months ago

Excellent! I can verify that the uploaded plans now appear in the table, along with a 'registered' status and DMP ID, for both Boulder and Northwestern.