Giter VIP home page Giter VIP logo

Comments (9)

birkir avatar birkir commented on June 11, 2024

Looks like there is a malformed GraphQL query being sent.

Can you open the network tab and find the network request to graphql endpoint at prismic, copy the query and paste it here?

There is a "view source" link right next to "Request Payload" at the bottom, so it's easy to copy paste.

from gatsby-source-prismic-graphql.

kkor avatar kkor commented on June 11, 2024

Woah, thanks for super fast reponses :D
There's a request to:
https://myrepo.prismic.io/previews/token/XFgwHxEAAOQ6vymn
where the token matches the preview cookie, but it's missing a payload if that's the one that should have it?
After that it keeps pinging:
https://myrepo.prismic.io/previews/XFgwHxEAAOQ6vymn/ping?ref=https%3A%2F%2Fmyrepo.prismic.io%2Fpreviews%2FXFhIpBEAAOQ6v49D
but no payloads there either?

from gatsby-source-prismic-graphql.

kkor avatar kkor commented on June 11, 2024

Yeah, so if the query in gatsby-browser is supposed to be a graphql parsed from the component, then that's definitely failing now, it's just that int "1826773283":

image

Looks like I'm doing something wrong, so I'll check out your example and try again.

from gatsby-source-prismic-graphql.

kkor avatar kkor commented on June 11, 2024

Okay, issue found... and I should have thought of this earlier: I'm using typescript. Changing my index.tsx -> index.jsx fixed the preview issue.

SInce you're using typescript in the plugin, I'm hopeful there's typescript support hidden here somewhere? :)

from gatsby-source-prismic-graphql.

birkir avatar birkir commented on June 11, 2024

Yes! Nice catch buddy! I'll update this issue tomorrow with a fix!

I am overwriting the babel loader that does not remove graphql queries (so they can be reused) and I remember a ts-plugin failed in some scenario. I'm on the phone now so let me research this a bit.

Thanks for the update!

from gatsby-source-prismic-graphql.

kkor avatar kkor commented on June 11, 2024

Could also be difference in the tsconfig / imports? I can match yours if you provide it, i'm currently using:

{
    "compilerOptions": {
        "declaration": true,
        "emitDecoratorMetadata": true,
        "esModuleInterop": true,
        "experimentalDecorators": true,
        "forceConsistentCasingInFileNames": true,
        "noImplicitAny": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "jsx": "react",
        "sourceMap": true,
        "strict": true,
        "target": "es5",
        "baseUrl": "./src",
        "module": "commonjs",
        "noImplicitReturns": true,
        "noImplicitThis": true,
        "preserveConstEnums": true,
        "removeComments": true,
        "strictNullChecks": true
    }
}

from gatsby-source-prismic-graphql.

birkir avatar birkir commented on June 11, 2024

I've checked a project we have that uses typescript and don't see anything that is different, however maybe the order of plugins matter. Make sure to put this plugin after typescript plugin in gatsby-config.

{
  "compilerOptions": {
    // Base directory to resolve non-relative module names.
    "baseUrl": "./src",
    // Specify module code generation
    "module": "commonjs",
    // Generates corresponding '.map' file.
    "sourceMap": true,
    // Enables experimental support for ES7 decorators.
    "experimentalDecorators": true,
    // Target latest version of ECMAScript.
    "target": "esnext",
    // Search under node_modules for non-relative imports.
    "moduleResolution": "node",
    // Process & infer types from .js files.
    "allowJs": true,
    // Don't emit; allow Babel to transform files.
    "noEmit": true,
    // Enable strictest settings like strictNullChecks & noImplicitAny.
    "strict": true,
    // Disallow features that require cross-file information for emit.
    "isolatedModules": true,
    // Import non-ES modules as default imports.
    "esModuleInterop": true,
    // Type declaration files to be included in compilation.
    "types": ["node"],
    // Specify library file to be included in the compilation.
    "lib": ["dom", "es2015", "es2017"],
    // Specify JSX code generation
    "jsx": "preserve",
    // Report errors on unused locals.
    "noUnusedLocals": true,
    // Report errors on unused parameters.
    "noUnusedParameters": true,
    // Do not emit comments to output.
    "removeComments": false,
    // Do not erase const enum declarations in generated code.
    "preserveConstEnums": true
  },
  // Specifies a list of glob patterns that match files to be included in compilation.
  "include": ["./src/**/*"]
}

from gatsby-source-prismic-graphql.

kkor avatar kkor commented on June 11, 2024

Omg! That was it! Thanks a bunch, wouldn't have realised that on my own! 🎉
Now let's hope everything else is smooth sailing :D

from gatsby-source-prismic-graphql.

birkir avatar birkir commented on June 11, 2024

Glad to help. Don't hesitate to report any more issues you have

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.