Support,
I’m using Netlify Graph to query a GitHub file so I can display its content in an 11ty page generated by a Serverless(Neltify) Function.
I’m able to get Netlify Graph to access the file from a private repo. While the Generate Handler
button does not seem to work, netlify graph:pull
does create the Netlify Function.
From an 11ty page, I use a form’s action to call the Function where I set it to use either the Client’s access token or mine. It then calls netlifyGraph which is where things break, for either token.
Request from ::ffff:127.0.0.1: GET /.netlify/functions/dynamic
Response with status 200 in 1623 ms.
CLI session closed, stopping monitoring...
CLI session closed, stopping monitoring...
Request from ::ffff:127.0.0.1: GET /.netlify/functions/TestResults?fetchGitHub=fetchGitHub
Using client's access token: false
TestResults.js: event.netlifyGraphToken: XXXXX
netlifyGraph.index.js accessToken: XXXXX
netlifyGraph.index.js response: {"errors":[{"message":"Missing auth for GitHub. Please reauthenticate.","path":["gitHub"],"extensions":{"service":"github","type":"auth/missing-auth","traceId":"aca330f4-7c8e-4581-a771-9d88b38d63a1"}}],"data":{"gitHub":null},"extensions":{"metrics":{"api":{"avoidedRequestCount":0,"requestCount":0,"totalRequestMs":0.0,"byHost":[]}}}}
TypeError: result.json is not a function
at /workspaces/rosie-core/netlify/functions/netlifyGraph/index.js:202:23
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
There are a few interesting things going on:
- The error message is not sent to the console. I found it by stepping through the code and adding
console.log("netlifyGraph.index.js response:", result);
after line 184. - I also console.log the access token from the TestResults Function to netlifyGgraph/index.js and it exists.
- On the Graph UI, under
Connected APIs and services
for GitHub, both Graph and API Authentication are enabled. - From the Graph Session page, I’m able to run the query and get the expected results.
- The Generated Handler and query in VS Code are the same as in UI
- To reauthenticate, I have logged out of Netlify and GitHub and logged in accordingly.
I’ll be happy to share the site URL in a private message.
Any help would be greatly appreciated. It feels like I’m so close
Thanks