Giter VIP home page Giter VIP logo

Comments (19)

mlbrgl avatar mlbrgl commented on June 11, 2024 3

@elkorn could you please reopen the issue? I tried with both:

and I am also seeing an empty edges array. The query runs fine in GraphiQL (with query variables) but as you mentioned in #47 (comment), the uid property is empty in pageContext.

I can also confirm than the last version the query runs properly is 2.8.8 (from @brandonfancher #32 (comment)). After that, the edges array is empty.

from gatsby-source-prismic-graphql.

ascii-husky avatar ascii-husky commented on June 11, 2024 3

Upgrading gatsby-source-prismic-graphql to 3.4.0-beta.2 did fix the problem for me.

from gatsby-source-prismic-graphql.

birkir avatar birkir commented on June 11, 2024

Good question.

Only thing I can think of is a case where its just the preview page.

https://github.com/birkir/gatsby-source-prismic-graphql/blob/master/packages/gatsby-source-prismic-graphql/src/gatsby-node.ts#L132

Also, you can check with the lang paramter

from gatsby-source-prismic-graphql.

elkorn avatar elkorn commented on June 11, 2024

heisenbug. Started working for no apparent reason. I deleted the cache multiple times so I don't think it was that which helped. As far as I was able to see from digging in - the plugin was actually passing the uid correctly into createPage, but it didn't come out to pageContext in WrapPage.

Closing for now, I'll reopen if I have any new information.

from gatsby-source-prismic-graphql.

mikeyp avatar mikeyp commented on June 11, 2024

I'm having the same issue, queries return empty results as if uid is not being passed in, even though I've verified it is being set in gatsby-node.js from this plugin.

My page component:

import { graphql } from "gatsby"
import * as React from "react"
import Layout from "../components/layout"

export const query = graphql`
  query Page($uid: String!) {
    prismic {
      page(uid: $uid, lang: "en-us") {
        title
        body
      }
    }
  }
`

const Page = ({ data }) => {
  console.log(data)
  return (
    <Layout>
      <h1>Test page....</h1>
    </Layout>
  )
}

Page.query = query

export default Page

and my gatsby-config.js contains:

    {
      resolve: 'gatsby-source-prismic-graphql',
      options: {
        repositoryName: `puppet`, // (required)
        accessToken: `12345`, // (optional)
        path: `/preview`, // (optional, default: /preview)
        previews: true, // (optional, default: false)
        pages: [{ // (optional)
          type: `Page`,         // TypeName from prismic
          match: `/page/:uid`,  // Pages will be generated under this pattern (optional)
          path: `/page`,        // Placeholder page for unpublished documents
          component: require.resolve('./src/content-types/page.js'),
          lang: `en-us`
        }],
      }
    },

But all I get back in my component is:

{
  data: {
    prismic: {
      page: null
    }
  }
}

The query works fine in GraphiQL so I don't think there's any problem with that, just not returning any data from the PageQuery for some reason.

I've tried this with previews enabled and disabled and had the same problem either way.

from gatsby-source-prismic-graphql.

kieranstartup avatar kieranstartup commented on June 11, 2024

I'm also running into the same issue @elkorn and @mikeyp, and it looks like rolling Gatsby back to 2.3.17 fixes the issue for now.

See here: #32 (comment)

from gatsby-source-prismic-graphql.

KenanYusuf avatar KenanYusuf commented on June 11, 2024

Also running into this issue, however, Gatsby 2.3.17 did not fix the issue for me. @mikeyp any luck in the end?

from gatsby-source-prismic-graphql.

erikjalevik avatar erikjalevik commented on June 11, 2024

Having the same problem. When running gatsby develop, the uid does not get passed to the GraphQL query. If doing gatsby build however, everything does work.

EDIT: now seems to work using gatsby 2.13.51 and gatsby-source-prismic-graphql 3.3.1.

from gatsby-source-prismic-graphql.

elkorn avatar elkorn commented on June 11, 2024

Reopening the issue for @mlbrgl.

from gatsby-source-prismic-graphql.

zlutfi avatar zlutfi commented on June 11, 2024

I am having this issue as well. Has anyone come up with a temporary workaround?

from gatsby-source-prismic-graphql.

doigo avatar doigo commented on June 11, 2024

Having the same issue here UID is not being passed to the page templates

from gatsby-source-prismic-graphql.

thormuller avatar thormuller commented on June 11, 2024

same issue, and fixed by upgrading to the 3.4.0-beta.2 (thanks @ascii-husky!)

from gatsby-source-prismic-graphql.

kieranstartup avatar kieranstartup commented on June 11, 2024

Thanks for the tip @ascii-husky, upgrading made it work for me as well.

from gatsby-source-prismic-graphql.

vincent-wantomo avatar vincent-wantomo commented on June 11, 2024

Hello everyone,

Got the same issue with :
"gatsby": "^2.17.6",
"gatsby-source-prismic-graphql": "^3.3.1",

updated to below and worked :
"gatsby": "^2.17.10",
"gatsby-source-prismic-graphql": "^3.3.1", (no changes)

from gatsby-source-prismic-graphql.

codebravotech avatar codebravotech commented on June 11, 2024

Had the same exact issue as vincent-wantomo, and updating to gatsby 2.17.10 did the trick for me also, in case anyone doesn't want their source plugin to be on a beta version

from gatsby-source-prismic-graphql.

fandy avatar fandy commented on June 11, 2024

Thank god, was going insane thinking I did something wrong. Can confirm that upgrading Gatsby passes uid correctly now.

from gatsby-source-prismic-graphql.

fandy avatar fandy commented on June 11, 2024

Looks like it's not working with useStaticQuery though.

from gatsby-source-prismic-graphql.

codebravotech avatar codebravotech commented on June 11, 2024

from gatsby-source-prismic-graphql.

nelsonreitz avatar nelsonreitz commented on June 11, 2024

Lost a couple of hours on the same issue, upgrading gatsby from 2.17.4 to 2.19.17 solved it. Thank you 👍

from gatsby-source-prismic-graphql.

Related Issues (20)

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.