Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby Config requires definition for "apiHost" #271

Open
stbly opened this issue Oct 18, 2023 · 0 comments
Open

Gatsby Config requires definition for "apiHost" #271

stbly opened this issue Oct 18, 2023 · 0 comments

Comments

@stbly
Copy link

stbly commented Oct 18, 2023

After updating to gatsby-source-sanity v7.9.0, node started throwing an obscure error right after Gatsby's onPreInit hook:

success onPreInit - 0.003s
info [sanity] Fetching remote GraphQL schema
error Cannot read properties of undefined (reading 'split')

I was eventually able to figure out that it was because apiHost was reading as undefined in the Sanity config. I didn't see anything in the documentation saying this needed to be provided in gatsby-config.js, but after adding it everything ran fine:

{
      resolve: 'gatsby-source-sanity',
      options: {
        ...
        apiHost: 'https://api.sanity.io',
        ....
      },
    },
}

I was also able to replicate this issue by starting a new gatsby project using Sanity as a source.

Node Version: v18.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant