CDLUC3 / dmsp_aws_prototype

Sceptre CloudFormation templates for DMPHub v2
MIT License
1 stars 0 forks source link

NSF awards API error when an award id is supplied by user #103

Closed briri closed 7 months ago

briri commented 8 months ago

The NSF awards API is logging an error (in stage so far).

Looks like we just need to escape spaces properly because switching pd 98-1610.json to pd+98-1610.json resolves the issue.

ERROR RequestId: 21827c45-886f-4697-b692-694b2c39864e, SOURCE: GET /awards/nsf, MESSAGE: External API error: https://api.nsf.gov/services/v1/awards/pd 98-1610.json is an invalid URI

ERROR RequestId: 21827c45-886f-4697-b692-694b2c39864e, 
SOURCE: GET /awards/nsf, 
MESSAGE: /opt/ruby/gems/3.2.0/uc3-dmp-external-api-0.0.20/lib/uc3-dmp-external-api/client.rb:40:in `rescue in call', 
/opt/ruby/gems/3.2.0/uc3-dmp-external-api-0.0.20/lib/uc3-dmp-external-api/client.rb:21:in `call', 
/var/task/app.rb:53:in `process', 
/var/runtime/lib/lambda_handler.rb:24:in `call_handler', 
/var/runtime/lib/runtime.rb:100:in `<main>'
briri commented 8 months ago

This is fixed and deployed to stage for testing. The NSF API does not find anything for that particular project number. The API is not returning an error though.

That 'PD 98-1610' is the funding "opportunity" number no the project/award number. Unfortunately I do not see a way to search the NSF API for an opportunity id: https://resources.research.gov/common/webapi/awardapisearch-v1.htm