Comments (12)
@GarciaPL, for me a new token fixed the problem. I managed to debug the token issue by removing all the keys in the query related to packages and it worked for me. If you still have issues, read the description of the package carefully, for me it worked.
Things to be attentive to:
- in
gatsby-config.js
you put the query that fetches all the data from GitHub at once ongatsby develop
- in your code you write queries without parameters you use in the GitHub query, e.g.
repositories(isFork: false) {...
ingatsby-config.js
should be then used in the code asrepositories {...
- avoid types like
Blob
in the actual code as you already have all the stuff needed - check GraphQL Playground (
/___grapql
on your host), especially thegithubData
. If there's nodata
inside, it means that your GitHub query ingatsby-config.js
failed for some reason
You can also take a look at the orlove.dev repo in my profile, in gatsby-config.js
and src/pages/index.tsx
.
I hope these tips will help. Cheers!
from gatsby-source-github-api.
No, not really. It was just me having a token that cannot access things I tried to get via GraphQL. This caused the query to get nothing from GitHub, which, in turn, made githubData
to have no data
property. Without it in place, the whole query failed. As it had the type it couldn't understand (Blob), it failed to even start the dev server. That's all, folks š
from gatsby-source-github-api.
@priestine So I assume that not enough privileges was set for token ? I am asking as I am having the same issue with unrecognized type Blob on my side
from gatsby-source-github-api.
@priestine thank you for your help! Now everything works as expected, much appreciated! šÆ
from gatsby-source-github-api.
Try this query in the code:
query {
githubData {
data {
repository {
object {
entries {
name
type
object {
text
}
}
}
}
}
}
}
It should work.
from gatsby-source-github-api.
Thank you! I would never find out that it should look like that. It works now! Thank you once again!
from gatsby-source-github-api.
Hey! I really liked this little conversation.
I'll try adding a small FAQ in the readme with the things you discovered to make it easier for other devs using this package.
Otherwise, consider this issue closed (but feel free to add more comments if you want)
from gatsby-source-github-api.
My apologies, everything works great! Ignore me š
from gatsby-source-github-api.
was it perhaps
edges {
node {
[stuff goes here]
}
}
instead of
nodes {
[stuff goes here]
}
?
from gatsby-source-github-api.
Glad I could help. š
from gatsby-source-github-api.
@priestine Apologize, but I was wrong that it works. It does for sure for the simple case of graphql without spreading used on types like getting info about user etc. When I have below graphql query defined in gatsby-config.js
which just returns blob of the files defined in the given repository. This query works in GitHub GraphQL API
graphQLQuery: `
query {
repository(owner: "CodingVoodoo", name: "template") {
object(expression: "master:") {
... on Tree {
entries {
name
type
object {
... on Blob {
text
}
}
}
}
}
}
}
`
it gives me two errors
Unknown type "Tree".
GraphQL request:7:20
6 | object {
7 | ... on Tree {
| ^
8 | entries {
and
Unknown type "Blob".
GraphQL request:12:26
11 | object {
12 | ... on Blob {
| ^
13 | text
Of course I am using query without parameters like
export const query = graphql`
query {
githubData {
data {
repository {
object {
... on Tree {
entries {
name
type
object {
... on Blob {
text
}
}
}
}
}
}
}
}
}
`
Would you be so kind and highlight where the problem is ? Only what I have found is that perhaps I need to create type definition as here specified Gatsby Creating type definitions
from gatsby-source-github-api.
Sure, np. Iām not an expert in the topic but the to me underlying idea here is that at your app launch the GitHub query is executed, producing a new GraphQL schema where the data already has the shape that was returned from github. Thus you no longer have the blob and other stuff. Maybe Iām wrong. š
from gatsby-source-github-api.
Related Issues (15)
- Media files for this repository
- Warning during node transformation when using gatsby-transformer-json HOT 2
- cannot query languages HOT 1
- GitHub Url Docs HOT 2
- Errors handling HOT 3
- Cant get gatsby-source-github-api to load properly HOT 5
- Getting contributors on each repostirory? HOT 3
- Gatsby v3.x compatibility HOT 5
- Breaks on Gatsby v3 because npm package needs published with new version HOT 2
- Cannot use variables in certain queries HOT 2
- Multiple queries HOT 2
- Limitations HOT 3
- Multiple queries? HOT 1
- Using this with markdown remark HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-source-github-api.