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-source-graphql fails #22785

Closed
andrewfairlie opened this issue Apr 3, 2020 · 17 comments · Fixed by #22848
Closed

gatsby-source-graphql fails #22785

andrewfairlie opened this issue Apr 3, 2020 · 17 comments · Fixed by #22848
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@andrewfairlie
Copy link
Contributor

Description

The latest version of gatsby-source-graphql fails because it's missing a file. Having dug into this a bit, I think it's because that file (batching/dataloader-link) is gitignored - https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-graphql/.gitignore#L2

Steps to reproduce

Install the latest version
Try building the site

Expected result

Gatsby should build

Actual result

Gatsby fails with

Error in "[HIDDENFORPRIVACY]/node_modules/gatsby-source-graphql/gatsby-node.js": Cannot find module './batching/dataloader-link'

Environment


  System:
    OS: macOS 10.15.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v10.16.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 80.0.3987.149
    Firefox: 74.0
    Safari: 13.0.5
  npmPackages:
    gatsby: ^2.13.41 => 2.20.12 
    gatsby-image: ^2.1.2 => 2.3.1 
    gatsby-plugin-canonical-urls: ^2.0.13 => 2.2.1 
    gatsby-plugin-emotion: ^4.0.7 => 4.2.1 
    gatsby-plugin-google-tagmanager: ^2.0.15 => 2.2.1 
    gatsby-plugin-manifest: ^2.2.5 => 2.3.3 
    gatsby-plugin-netlify: ^2.1.31 => 2.2.1 
    gatsby-plugin-offline: ^3.0.6 => 3.1.2 
    gatsby-plugin-react-helmet: ^3.0.12 => 3.2.1 
    gatsby-plugin-react-svg: ^2.1.1 => 2.1.2 
    gatsby-plugin-robots-txt: ^1.4.0 => 1.5.0 
    gatsby-plugin-sharp: ^2.1.3 => 2.5.3 
    gatsby-plugin-sitemap: ^2.1.0 => 2.3.1 
    gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4 
    gatsby-source-filesystem: ^2.0.37 => 2.2.2 
    gatsby-source-graphql: ^2.3.1 => 2.3.1 
    gatsby-source-instagram: ^0.5.0 => 0.5.1 
    gatsby-source-twitter: ^3.0.0 => 3.2.1 
    gatsby-transformer-csv: ^2.2.1 => 2.2.1 
    gatsby-transformer-sharp: ^2.1.21 => 2.4.3 
@andrewfairlie andrewfairlie added the type: bug An issue or pull request relating to a bug in Gatsby label Apr 3, 2020
@mbifulco
Copy link
Contributor

mbifulco commented Apr 3, 2020

@andrewfairlie you beat me to it! I came here to report exactly this. 👍

@shide1989
Copy link

Just updated the package and i Got it too. For now i will revert to previous version

@copperwall
Copy link
Contributor

copperwall commented Apr 3, 2020

Fix PR here #22804

I tried out running npm publish --dry-run to see what would be placed in the package and it looks like the .ts files aren't being transformed by babel and aren't getting into the package before it's published.

> gatsby-source-graphql@2.3.1 prepare .
> cross-env NODE_ENV=production npm run build


> gatsby-source-graphql@2.3.1 build /Users/zolokar/projects/gatsby/packages/gatsby-source-graphql
> babel src --out-dir . --ignore **/__tests__

Successfully compiled 3 files with Babel.
npm notice 
npm notice 📦  gatsby-source-graphql@2.3.1
npm notice === Tarball Contents === 
npm notice 59B    .babelrc      
npm notice 3.5kB  gatsby-node.js
npm notice 13B    index.js      
npm notice 1.4kB  transforms.js 
npm notice 1.3kB  package.json  
npm notice 16.1kB CHANGELOG.md  
npm notice 9.4kB  README.md     
npm notice === Tarball Details === 
npm notice name:          gatsby-source-graphql                   
npm notice version:       2.3.1                                   
npm notice package size:  7.1 kB                                  
npm notice unpacked size: 31.8 kB                                 
npm notice shasum:        98e7b1c2f0352067cafd232577f681e596251f8f
npm notice integrity:     sha512-R+cW35Stg+Xsx[...]PAVWgxahuqt9g==
npm notice total files:   7                                       
npm notice 
+ gatsby-source-graphql@2.3.1

I made a PR that adds the .ts extension in the build step so that babel doesn't ignore them and that seems to do that trick

npm publish --dry-run

> gatsby-source-graphql@2.3.1 prepare .
> cross-env NODE_ENV=production npm run build


> gatsby-source-graphql@2.3.1 build /Users/zolokar/projects/gatsby/packages/gatsby-source-graphql
> babel src --out-dir . --ignore **/__tests__ --extensions ".ts,.js"

Successfully compiled 11 files with Babel.
npm notice 
npm notice 📦  gatsby-source-graphql@2.3.1
npm notice === Tarball Contents === 
npm notice 178B   .babelrc                   
npm notice 2.7kB  batching/dataloader-link.js
npm notice 2.6kB  gatsby-node.js             
npm notice 13B    index.js                   
npm notice 10.7kB batching/merge-queries.js  
npm notice 1.0kB  transforms.js              
npm notice 1.4kB  package.json               
npm notice 16.1kB CHANGELOG.md               
npm notice 9.4kB  README.md                  
npm notice === Tarball Details === 
npm notice name:          gatsby-source-graphql                   
npm notice version:       2.3.1                                   
npm notice package size:  10.7 kB                                 
npm notice unpacked size: 44.1 kB                                 
npm notice shasum:        65d77890da6496a98a09a0300ee559afd550364c
npm notice integrity:     sha512-x3Ub+ztY+rGSt[...]i7RdX+lF5FuyA==
npm notice total files:   9                                       
npm notice 
+ gatsby-source-graphql@2.3.1

@calebemachado
Copy link

calebemachado commented Apr 3, 2020

I have the following problem, but I don't know if is related because I'm using .tsx files. This is the code from console:

Error in "[HIDDENFORPRIVACY]\node_modules\gatsby-source-graphql\gatsby-node.js": Cannot find module './batching/dataloader-link' Error: Cannot find module './batching/dataloader-link'

@Jaikant
Copy link
Contributor

Jaikant commented Apr 4, 2020

I have the same problem, reverting to the previous version for now.

@riccardolardi
Copy link

riccardolardi commented Apr 4, 2020

Same problem here. Using 2.3.0 for the moment

@lalasmuathasim
Copy link

My Docker build also fails with error

Error in "/var/www/node_modules/gatsby-source-graphql/gatsby-node.js": Cannot find module './batching/dataloader-link'
Error: Cannot find module './batching/dataloader-link'

I tried different versions of gatsby-source-graphql including the latest

@glauberfc
Copy link
Contributor

I'm getting errors too: Error in "/Users/glauber/Dev/delivering-hope/node_modules/gatsby-source-graphql/gatsby-node.js": Cannot find module './batching/dataloader-link'

@henry-ns
Copy link

henry-ns commented Apr 4, 2020

Me too, I go back to 2.1.32 version, which was the last one I used.

@lalasmuathasim
Copy link

Me too, I go back to 2.1.32 version, which was the last one I used.

do you have any luck with 2.1.32

@henry-ns
Copy link

henry-ns commented Apr 4, 2020

Me too, I go back to 2.1.32 version, which was the last one I used.

do you have any luck with 2.1.32

@lalasmuathasim, yes, it works

@flowtrader2016
Copy link

Me too, I go back to 2.1.32 version, which was the last one I used.

do you have any luck with 2.1.32

@lalasmuathasim, yes, it works

Can you please let me know the commands to go back to the 2.1.32 version?

@kmtchl
Copy link

kmtchl commented Apr 5, 2020

Me too, I go back to 2.1.32 version, which was the last one I used.

do you have any luck with 2.1.32

@lalasmuathasim, yes, it works

Can you please let me know the commands to go back to the 2.1.32 version?

npm install gatsby-source-graphql@2.1.32

donjo9 added a commit to donjo9/run-with-gatsby that referenced this issue Apr 5, 2020
@amykapernick
Copy link

I'm also having this issue, will revert back until this is sorted 👍

@bogdansoare
Copy link

bogdansoare commented Apr 6, 2020

same issue

@vladar
Copy link
Contributor

vladar commented Apr 6, 2020

Sorry for the hassle. I prematurely used Typescript for a new Query Batching feature without appropriate TS build configuration (worked locally because of IDE).

Gatsby has not decided yet to switch plugins to TS as it will make contributions harder. So I just converted TS files back to vanilla JS in #22848 which should fix this issue. We will publish a version with the fix in the next couple of hours.

@vladar
Copy link
Contributor

vladar commented Apr 6, 2020

Should be fixed in gatsby-source-graphql@2.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet