prismicio / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
17 stars 14 forks source link

Preview not routing to my page #44

Closed struckm closed 4 years ago

struckm commented 4 years ago

I'm running into an issue with getting Preview working correctly in my local environment. It's not routing to the page I'm previewing, but if I manually update the URL in the browser, changes I make in Prismic will show up correctly in my preview. I have my API configured for Public API for Master only. The URL it routes to is localhost:port/preview?token=, is there a way to diagnose the problem. Also, I'm using the following versions: gatsby-source-graphql-universal: 3.4.12, gatsby-source-prismic-graphql: 3.6.11.

mrseanbaines commented 4 years ago

@struckm Have you set up your linkResolver?

struckm commented 4 years ago

Yes my linkResolver is registered with the registerLinkResolver module from gatsby-source-prismic-graphql, in the gatsby-browser.js file. But what's odd is that function is never called. I did notice the following error message in the browser console:

Uncaught (in promise) TypeError: e is not a function at prismic-javascript.min.js:1

I was using the gatsby-source-prismic plugin before and was able to get preview working.

Not sure how where to look to find out why it's not routing properly.

jodiedoubleday commented 4 years ago

I noticed the other day that in the readme for this plugin the path in your gatsby config has been changed to previewPath i.e previewPath: '/blogpost',

I don't know if that helps

struckm commented 4 years ago

@jodiedoubleday thanks for following up. I found out what the problem, and it was how I was importing my linkResolver function in my gatsby-browser.js file.