-
Notifications
You must be signed in to change notification settings - Fork 33
fix: avoid errors when excluding content types with multiple sources … #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: avoid errors when excluding content types with multiple sources … #246
Conversation
Staging->main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ccarrascal Thanks for the update! Please verify the suggested feedback—everything else looks good to me.
Once approved, we’ll proceed to merge the changes into staging and validate the functionality there.
…using the same schema
be3011f
to
373c43b
Compare
@ccarrascal Just revisiting the issue for clarity—while testing the changes, could you please share the exact error you were encountering during node generation? It would help in documenting and validating the fix better. Could you also help me with the steps to reproduce ?
|
@ccarrascal could you please provide me with an update here? |
Hi there, sorry for the late reply, I have been out for some days. This is very weird. I am testing it again and now I can't reproduce the error anymore. https://github.com/contentstack/gatsby-source-contentstack/blob/master/src/normalize.js#L61 It was because contentType variable was null, and so contentType.schema failed with an error. That's why I introduced the check in source-node.js file to avoid calling normalizeEntry with a null value, but as I say, I can't reproduce it anymore. I still think it's good idea to introduce that check just in case, but I am a bit puzzled. What's the error that you are getting? I see that you are using a different type_prefix config parameter there, and I am not, cause the prefix change will make our content queries to fail. |
Thanks for the update, @ccarrascal I wasn’t able to reproduce the issue on my end either — that’s why I was hoping to get the exact error message or a screenshot from your side, just to confirm the scenario. Also, could you please confirm if you’re using the same type_prefix in both your config and your GraphQL content queries? Just want to rule out any mismatches there. If possible, it would be great if you could try reproducing the issue once more. This would help us validate the necessity of the null check and move forward with the PR. Appreciate your help! |
Hi @abhishek305 I have been checking with other developers in our team to see if they can reproduce the problem, but we couldn't. Regarding the type_prefix, I can confirm we are using the same for both config, we can't really change that, as it will break our queries and we'll have to rewrite them, and that was what we were trying to avoid in the first place by just ignoring some content types. So from our side, it works now, so there's no need to merge this PR anymore apparently. I still don't know why it works now, maybe some recent changes in the CS API? I'll let you decide if you want to merge it in or not, cause it does not look like we need it anymore. Thanks a lot for your support in this issue. Best regards |
Thanks for the confirmation, Carlos! Since the issue is no longer reproducible and everything is working fine on your end — including consistent type_prefix usage and successful builds — I’ll go ahead and close this PR and the related ticket. Appreciate your follow-up and the detailed checks you did with your team. If the issue resurfaces, feel free to reach out and we can revisit the fix. Thanks again! Best regards, cc @PriteshJain |
…using the same schema
PR to fix errors happening while building a site importing content from two different stacks.
Our schema is the same in both stacks and we just want to combine the content of both, but we need to exclude some content types from the shared stack that we don't want to import.
We are using this setup in our gatsby-config file:
The first instance (shared content) is excluding some content types with
excludeContentTypes: ["shell"]
This is creating errors as the contentType variable is empty because there is no match in
contentTypesMap[item.content_type_uid]
The idea is to avoid creating the node if the content type uid is in the list of excluded content types, or it just null.