Git Product home page Git Product logo

Comments (12)

orlowdev avatar orlowdev commented on June 6, 2024 2

@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 on gatsby develop
  • in your code you write queries without parameters you use in the GitHub query, e.g. repositories(isFork: false) {... in gatsby-config.js should be then used in the code as repositories {...
  • avoid types like Blob in the actual code as you already have all the stuff needed
  • check GraphQL Playground (/___grapql on your host), especially the githubData. If there's no data inside, it means that your GitHub query in gatsby-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.

orlowdev avatar orlowdev commented on June 6, 2024 1

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.

GarciaPL avatar GarciaPL commented on June 6, 2024 1

@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.

GarciaPL avatar GarciaPL commented on June 6, 2024 1

@priestine thank you for your help! Now everything works as expected, much appreciated! šŸ’Æ

from gatsby-source-github-api.

orlowdev avatar orlowdev commented on June 6, 2024 1

Try this query in the code:

query {
    githubData {
      data {
        repository {
          object {
              entries {
                name
                type
                object {
                    text
                  }
                }
            }
          }
        }
    }
  }

It should work.

from gatsby-source-github-api.

GarciaPL avatar GarciaPL commented on June 6, 2024 1

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.

ldd avatar ldd commented on June 6, 2024 1

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.

orlowdev avatar orlowdev commented on June 6, 2024

My apologies, everything works great! Ignore me šŸ˜‚

from gatsby-source-github-api.

ldd avatar ldd commented on June 6, 2024

was it perhaps

              edges {
                node {
                 [stuff goes here]
                  }
                }

instead of

             nodes {
                 [stuff goes here]
                }

?

from gatsby-source-github-api.

orlowdev avatar orlowdev commented on June 6, 2024

Glad I could help. šŸ‘

from gatsby-source-github-api.

GarciaPL avatar GarciaPL commented on June 6, 2024

@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.

orlowdev avatar orlowdev commented on June 6, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.