Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Missing fragments on Mac Os #69

Open
JoseRFelix opened this issue Mar 11, 2020 · 10 comments
Open

Missing fragments on Mac Os #69

JoseRFelix opened this issue Mar 11, 2020 · 10 comments
Labels
need reproduction Potentially a bug, but haven't been able to re-produced yet

Comments

@JoseRFelix
Copy link

JoseRFelix commented Mar 11, 2020

Whenever I try to run graphql codegen on my mac, I get the following error:

image

It seems to work fine on Linux (running Pop!_os 19.10). I believe it has to be related to the differences in paths of Mac os. By the way, I have gatsby-plugin-sharp dep. which hosts the fragments.

@d4rekanguok
Copy link
Owner

Hi @Jfelix61, thank you for opening an issue!

What is the version of gatsby, gatsby-transformer-sharp, and gatsby-plugin-ts/graphql-codegen of your project? Are they the same in both install?

@JoseRFelix
Copy link
Author

Hi @d4rekanguok,

Versions:

  • gatsby : 2.19.39
  • gatsby-transformer-sharp : 2.3.18
  • gatsby-plugin-graphql-codegen: 2.4.0

@d4rekanguok
Copy link
Owner

Got it. To narrow down the cause of the issue, could you try cloning this reproduction repo?
https://github.com/d4rekanguok/gatsby-ts-69-repro

It uses the same versions as outlined above. I use sharp fragment in this file:
https://github.com/d4rekanguok/gatsby-ts-69-repro/blob/master/src/components/image.tsx

I haven't been able to get the same error on MacOS & Ubuntu 16, perhaps it's something else.

  • Did you update Gatsby recently? Maybe cleaning the cache could help.
  • One other thing I can think of, is if you were using a monorepo setup with yarn or lerna. But from the path name in your image, I don't think that is the case.
  • Are you using something that might symlink package instead of installing them in node_modules?

@JoseRFelix
Copy link
Author

Your repo runs without any problem 🤔.

  • Did you update Gatsby recently? Maybe cleaning the cache could help.
    Cleaned it and still have the same error.
  • One other thing I can think of, is if you were using a monorepo setup with yarn or lerna. But from the path name in your image, I don't think that is the case.
    No, I'm not using a monorepo
  • Are you using something that might symlink package instead of installing them in node_modules?
    No

@d4rekanguok d4rekanguok added the need reproduction Potentially a bug, but haven't been able to re-produced yet label Mar 13, 2020
@d4rekanguok
Copy link
Owner

This is tough, I'd need your help to reproduce this issue — your experience is valuable & I would love to sort this out, or at the very least add a warning to other users.

@JoseRFelix
Copy link
Author

Yes, I will try to debug it and see if I can find the cause.

@JoseRFelix
Copy link
Author

JoseRFelix commented Mar 19, 2020

So I've been investigating and now get the error on Linux, Mac OS and Windows. Fortunately I've found a clue on where the problem lies.

The fragments file is not being parsed by codegen plugin. When explicitly added to document path it returns that fragments does not contain graphql definitions.

image

Edit:
As a workaround, I added a custom file in my src with the fragments from fragments. It seems to work for now.

@d4rekanguok
Copy link
Owner

Thank you for sharing the issue, I will check it out -- it really should be able to find stuffs in node_modules, we might had overlooked something.

@gynekolog
Copy link

It looks like the same problem at issue #82

@d4rekanguok
Copy link
Owner

It's possible, this issue is opened before graphql 15 was released though. This fragment issue is very finicky, I haven't been able to consistently address it yet :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need reproduction Potentially a bug, but haven't been able to re-produced yet
Projects
None yet
Development

No branches or pull requests

3 participants