Skip to content

Fix failed start up due to Contentful type changes#402

Merged
cakr322 merged 4 commits into
masterfrom
fix-proxy-not-starting-up
Aug 24, 2023
Merged

Fix failed start up due to Contentful type changes#402
cakr322 merged 4 commits into
masterfrom
fix-proxy-not-starting-up

Conversation

@devslashnoel
Copy link
Copy Markdown
Member

@devslashnoel devslashnoel commented Aug 24, 2023

Description

cer-graphql was not able to launch since at least a week ago. Error was "Query.featuredItemsItems defined in resolvers, but not in schemas"
The issue seems to be a possible change in the output of Contentful's GraphQL API, particularly for introspection query. We use the GraphQL schema and the list of types to determine which content types require a custom authentication resolver (see getProtectedTypes()). The function would filter for types with "Filter" in it, then construct a list of resolver names based on types that have an ssoProtected field in it. The constructed names were made on the assumption that all "xFilter" types have a corresponding "x" type, but new(?) types seem to not match this pattern for linked items. The corresponding type name for them is "xItem". This results in the error because the generated resolver name does not match any queries.

Solution

Rewrote the getProtectedTypes function to iterate through all types. Filter for types that have an ssoProtected field and has contentfulMetadata field (though perhaps only checking for ssoProtected field is needed). Also add their corresponding collection queries. The embedded types are not included in the filtered list.

Screenshots

Testing

Existing tests should pick up any problems.

Have the changes been checked in the following browsers?

  • Chrome
  • Safari
  • Firefox
  • Edge

@cakr322 cakr322 merged commit f5f18cd into master Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants