Gatsby 3 touchNode deprecation warning
brxck opened this issue · 4 comments
Prerequisites
[X] Put an X between the brackets on this line if you have done all of the following:
- Read through the README fully.
- Ensured you are running Node v.10 or above.
- Made sure you're using at least Gatsby v.2.0.15.
- Checked that your issue isn't already filed.
Describe the bug
Using the latest gatsby-source-stripe with Gatsby 3 triggers a deprecation warning:
warning Calling "touchNode" with an object containing the nodeId is deprecated. Please pass the node directly to the function: touchNode(node) "touchNode" was called by gatsby-source-stripe
The touchNode
call in question is here.
To Reproduce
Steps to reproduce the behavior:
- Start Gatsby 3 development server
Versions (please complete the following information):
gatsby: 3.1.2
gatsby-source-stripe: 3.2.2
Gatsby config:
{
resolve: `gatsby-source-stripe`,
options: {
objects: ["Price"],
secretKey: process.env.STRIPE_SECRET_KEY,
downloadFiles: true,
auth: false,
},
},
@brxck So I'm a little fuzzy on the implementation here, but in this file would I then just pass the node
into saveNodeFromGarbageCollection
, or maybe touchNode
orrr does cachedFileData
have a reference to the node? I can dig in at some point, but thought I'd ask here first in case you have more insight.
I'm also fuzzy here. My naive impression is that there are two different nodes within checkCache()
. node
is the Stripe resource node, while the node referred to bycachedFileData.fileNodeId
is the File node that would belong to it.
I don't think we actually have a reference to the File node being touched, so you might have to retrieve it via the getNode
helper? This code and these Gatsby APIs are new to me though, so take that with a grain of salt 😅
Ah yeah maybe it's as simple as passing:
this node into saveNodeFromGarbageCollection
and thus into touchNode
. I'll try that and see how it goes.
This should be resolved in the latest version, so closing this now. Feel free to reopen if you continue to experience the issue.