Fetch error while querying from Gatsby

SOLVED. It’s a VScode / WSL issue. Long story, short… restart WSL every so often!

I just started getting this fetch error on queries that had been working until just now.

request to https://api.8base.com/xxxxxxxxxxxxxxxxxxxxxxxxxx failed, reason: getaddrinfo EAI_AGAIN api.8base.com api.8base.com:443

Any ideas?

Sebastion asked me to post the query. This is the Gatsby code:

import { graphql, useStaticQuery } from 'gatsby';

const usePosts = () => {
  const data = useStaticQuery(graphql`
    query {
      eightbase {
        postsList {
          items {
            id
            slug
            title
            published
          }
        }
      }
    }
  `);

  return data.eightbase.postsList.items.map(post => ({
    id: post.id,
    slug: post.slug,
    title: post.title,
    published: post.published
  }));
};

export default usePosts;

It was working fine a few hours ago. No changes.

1 Like

Appears to not be an issue with 8base or Gatsby.

Using VScode and WSL… over the course of a couple hour session it lost the ability to do DNS lookups. Shutdown WSL, restarted, and we’re back in business.

:+1:

1 Like

Hey John! So it’s working now???

Yeah, very odd. I’m using the terminal in VScode into WSL. For some reason DNS lookups just stopped working until I restarted WSL. The error message was similar to other frameworks (non-Gatsby) and they mentioned the DNS possibility.

Sorry to hit ya with that one so late last night! :slight_smile:

Lol don’t sweat it man!