NASA-IMPACT / admg-backend

Apache License 2.0
2 stars 0 forks source link

Problems running run yarn develop in the admg-casei #621

Closed heidimok closed 2 months ago

heidimok commented 3 months ago

Describe the bug

Problem blocking deployments from staging to production for the CASEI UI making it difficult to do changes in the frontend.

Wille can update campaigns in staging as he has access to the S3 bucket. But the production bucket can only be updated from the github action.

Would be good to plan to work soon on a solution to this problem as we have a backlog of UI updates in staging.

Seeking some

catch error FetchError: invalid json response body at https://admg.nasa-impact.net/api/doi reason: Unexpected token < in JSON at position 0
    at /Users/wille/projects/devseed/admg-casei/node_modules/node-fetch/lib/index.js:273:32
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at fetchData (/Users/wille/projects/devseed/admg-casei/gatsby-node.js:218:16)
    at async Promise.all (index 4)
    at Object.exports.sourceNodes (/Users/wille/projects/devseed/admg-casei/gatsby-node.js:168:21)
    at runAPI (/Users/wille/projects/devseed/admg-casei/node_modules/gatsby/src/utils/api-runner-node.js:487:16) {
  type: 'invalid-json'
}
success Checking for changed pages - 0.001s
success source and transform nodes - 61.219s

 ERROR 

Missing onError handler for invocation 'building-schema', error was 'Error: Type with name "alias" does not exists'. Stacktrace was 'Error: Type with name
"alias" does not exists
    at SchemaComposer.get (/Users/wille/projects/devseed/admg-casei/node_modules/graphql-compose/src/TypeStorage.ts:39:13)
    at ThunkComposer._thunk (/Users/wille/projects/devseed/admg-casei/node_modules/graphql-compose/src/TypeMapper.ts:737:34)
    at ThunkComposer.get ofType [as ofType] (/Users/wille/projects/devseed/admg-casei/node_modules/graphql-compose/src/ThunkComposer.ts:21:34)
    at ThunkComposer.getType (/Users/wille/projects/devseed/admg-casei/node_modules/graphql-compose/src/ThunkComposer.ts:45:18)
    at ListComposer.getType (/Users/wille/projects/devseed/admg-casei/node_modules/graphql-compose/src/ListComposer.ts:14:40)
    at ObjectTypeComposer.getFieldConfig (/Users/wille/projects/devseed/admg-casei/node_modules/graphql-compose/src/ObjectTypeComposer.ts:600:18)
    at forEach (/Users/wille/projects/devseed/admg-casei/node_modules/gatsby/src/schema/extensions/index.js:220:48)
    at Array.forEach (<anonymous>)
    at forEach (/Users/wille/projects/devseed/admg-casei/node_modules/gatsby/src/schema/extensions/index.js:215:8)
    at Array.forEach (<anonymous>)
    at processFieldExtensions (/Users/wille/projects/devseed/admg-casei/node_modules/gatsby/src/schema/extensions/index.js:211:32)
    at processTypeComposer (/Users/wille/projects/devseed/admg-casei/node_modules/gatsby/src/schema/schema.js:204:11)
    at map (/Users/wille/projects/devseed/admg-casei/node_modules/gatsby/src/schema/schema.js:178:7)
    at Array.map (<anonymous>)
    at updateSchemaComposer (/Users/wille/projects/devseed/admg-casei/node_modules/gatsby/src/schema/schema.js:177:50)
    at buildSchema (/Users/wille/projects/devseed/admg-casei/node_modules/gatsby/src/schema/schema.js:71:3)'

⠹ building schema 

Things Tried

heidimok commented 3 months ago

Status

Adding some notes from Slack to keep this issue updated. We are running into an issue where the data that comes back from the ADMG_backend_API does not have the shape that Gatsby is expecting to create the links specified in gatsby_node.js. It seems that we introduced a Campaign, Instrument, or Platform etc in production recently that does not have the data shape we need in the frontend.

Next

Possible next step in fixing immediate issue Look at the most recently published Campaigns and look for the fields that are failing like aliases and measurement_type. Compare those fields to the ones of campaigns that we know are working. We should fix this and get the current deployment flowing again asap.

Broader notes on the root cause Write a new issue seeking a solution where we don't allow data in production that doesn't match the data shape we need in the frontend. As new curators join ADMG, it's likely they'll input data without knowing the data shape we need. Currently there isn't always much guidance or prevention so they have no idea they are causing the deployment to fail.