Closed jorge-mattress closed 2 years ago
Hi! Any chance we can take a look at the code?
Oh forgot to provide more details, please check the gatsny-node.js here: https://gist.github.com/jorge-mattress/4248c423e7b5e76927a01160a7e238a0
And the template that renders the pages https://gist.github.com/jorge-mattress/bed4a39c6b8f9acd5d43b440250fe39f
The bits that matter the more for us inside the graphql are "promotions" and "brand" and both return null or empty array, hope this helps:
promotions { startDate endDate description affiliateLinkCta altTitle affiliateLinkPromotion { affiliateLink shortenedAffiliateLink } } brand { meta { updatedAt } brandName discountFlat discountPercentage promotions { startDate endDate description affiliateLinkCta altTitle affiliateLinkPromotion { affiliateLink shortenedAffiliateLink } } }
Please let me know if you need more info, many thanks in advance!
Yes, please can you send us the complete Gatsby project + the name of your DatoCMS project at support@datocms.com? If the Gatsby project is on Github, you can share it with me!
Thanks
Thanks! already sent the info to the provided email
@jorge-mattress I've been able to reproduce the issue, thank you.
Honestly, I haven't the slightest idea why it does that. I assume it's a bug in Gatsby, as we're we're simply generating the nodes.. and everything else is in Gatsby's hands. So if the nodes we generate work in one context, they should also work in other.
I've used our internal Slack channel with Gatsby to ask for help, hope to give you some updates soon 😢
Thanks a lot for your help @stefanoverna, I hope we can solve this issue soon.
We've been looking at differences when running queries in develop vs in engine and in internals of link
resolver we saw differences in both.
In particular in https://github.com/datocms/gatsby-source-datocms/blob/741119e9d9250bffdffdded07b335de106eb53ad/src/hooks/sourceNodes/createTypes/item/fields/link.js#L28
In engines we get undefined
vs A proxy in gatsby develop
. We also see that entitiesRepo
seems much smaller in engines - it lacks some keys at very least
Left is engines (dsg/ssr case), right is gatsby develop:
Because left is returning undefined
I assume that's why links resolve to empty array. Does entitiesRepo
need to be "populated" somehow?
Update on my previous comment - in PQR mode seems like entitiesRepo
is populated from "cache" - https://github.com/datocms/gatsby-source-datocms/blob/741119e9d9250bffdffdded07b335de106eb53ad/src/hooks/createSchemaCustomization/index.js#L51
In DSG this condition is falsy, but even then when I forced this to load - it would work locally (for gatsby serve
as cache
is just there), but it still wouldn't work on Gatsby Cloud (or others) as cache
is not transported over (cache
was supposed to be used as persisted memoization - not as source of truth).
Is there a chance to adjust what resolvers are using to NOT rely on entitiesRepo
?
fyi: we've seen this behaviour using gatsby-source-datocms 3.0.8
running the latest versions of gatsby (4.7.2) and gatsby-source-datocms (3.0.15) doesn't seem to solve the issue
Hey @pieh, thanks for investigating.
Please @jorge-mattress && @dw-srohrlack try gatsby-source-datocms v3.0.18-0 and let us know if it fixes the issue!
Excellent news! Going to post the results in short. But thanks beforehand for all the help!
hey @jorge-mattress and @dw-srohrlack we have a preview version v3.0.18-0 that should fix this issue, can you please upgrade and let us know? Thanks!
Hi Matteo, I tested the preview version and I can confirm the DSG its working! All the issues specially with the affiliate links have been fixed. Please let me know if you need more in deep feedback..
And a big thanks for you and your team for fixing the issue
excellent! Thank you very much for the feedback!
Nothing else to do on your end, we'll soon release the version to everyone, but you shouldn't need to upgrade. Thank you again!
I can confirm that it's working marvelous 👌
Released as 3.0.18! Thanks everyone!
I'm using gatsby v4 and a flag
defer = true
on certain pages with thecreatePage
function insidegatsby-node.js
And the returned data from the dato-cms-source plugin contains certain items with empty or null values.
A sample of the returned data looks like this:
{ "promotions": [], "brand": null, "name": "Ecosa", }
You can see a test website here with the defer flag set to true: https://nzfeaturedsg.gatsbyjs.io/comparer/ecosa-mattress-vs-emma-original-mattress-vs-napp-mattress-vs-peacelily-mattress
And defer flag set to false: https://nzfeaturedsg.gatsbyjs.io/comparer/ecosa-mattress-vs-emma-original-mattress
Many thanks in advance for any feedback.