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 plugin will not authenticate with GitHub using Now 2.0 #154

Closed
jameswlane opened this Issue Jan 4, 2019 · 3 comments

Comments

2 participants
@jameswlane
Copy link

jameswlane commented Jan 4, 2019

When Now 2.0 uses the now-builders builds my Gatsby site in the sites build process it queries GitHub's GraphQL api for a list of my projects. The build receives a 401 response but when building locally it works fine.

I have added my GitHub token as a secret in my now.json See here.

Here is the full project repo.

If anyone has ran into this or has some advice they could throw my way it would be greatly appreciated.
This is the Now 2.0 output I am getting:

01/03 09:26 AM (43m)



  ServerError: Response not successful: Received status code 401
  
  - bundle.umd.js:36 throwServerError
    [207289e8]/[apollo-link-http-common]/lib/bundle.umd.js:36:21
  
  - bundle.umd.js:64 
    [207289e8]/[apollo-link-http-common]/lib/bundle.umd.js:64:17
  
  - util.js:16 tryCatcher
    [207289e8]/[bluebird]/js/release/util.js:16:23
  
  - promise.js:512 Promise._settlePromiseFromHandler
    [207289e8]/[bluebird]/js/release/promise.js:512:31
  
  - promise.js:569 Promise._settlePromise
    [207289e8]/[bluebird]/js/release/promise.js:569:18
  
  - promise.js:614 Promise._settlePromise0
    [207289e8]/[bluebird]/js/release/promise.js:614:10
  
  - promise.js:694 Promise._settlePromises
    [207289e8]/[bluebird]/js/release/promise.js:694:18
  
  - async.js:138 _drainQueueStep
    [207289e8]/[bluebird]/js/release/async.js:138:12
  
  - async.js:131 _drainQueue
    [207289e8]/[bluebird]/js/release/async.js:131:9
  
  - async.js:147 Async._drainQueues
    [207289e8]/[bluebird]/js/release/async.js:147:5
  
  - async.js:17 Immediate.Async.drainQueues
    [207289e8]/[bluebird]/js/release/async.js:17:14
  

01/03 09:26 AM (43m)

npm

01/03 09:26 AM (43m)

 ERR! code ELIFECYCLE

01/03 09:26 AM (43m)

npm

01/03 09:26 AM (43m)

 ERR!

01/03 09:26 AM (43m)

 errno

01/03 09:26 AM (43m)

 1

01/03 09:26 AM (43m)

npm

01/03 09:26 AM (43m)

 ERR!

01/03 09:26 AM (43m)

 gatsby-starter-default@0.1.0 build: `gatsby build`

01/03 09:26 AM (43m)

npm ERR!

01/03 09:26 AM (43m)

 Exit status 1

01/03 09:26 AM (43m)

npm

01/03 09:26 AM (43m)

 ERR!

01/03 09:26 AM (43m)

 
npm

01/03 09:26 AM (43m)

 ERR!

01/03 09:26 AM (43m)

 Failed at the gatsby-starter-default@0.1.0 build script.

01/03 09:26 AM (43m)

npm 

01/03 09:26 AM (43m)

ERR!

01/03 09:26 AM (43m)

 This is probably not a problem with npm. There is likely additional logging output above.

01/03 09:26 AM (43m)


01/03 09:26 AM (43m)

npm ERR! A complete log of this run can be found in:
npm 

01/03 09:26 AM (43m)

ERR!     /tmp/.npm/_logs/2019-01-03T15_26_27_400Z-debug.log

01/03 09:26 AM (43m)

npm

01/03 09:26 AM (43m)

 ERR!

01/03 09:26 AM (43m)

 code ELIFECYCLE

01/03 09:26 AM (43m)

npm

01/03 09:26 AM (43m)

 ERR! 

01/03 09:26 AM (43m)

errno 1

01/03 09:26 AM (43m)

npm

01/03 09:26 AM (43m)

 ERR! gatsby-starter-default@0.1.0 now-build: `npm run build`

01/03 09:26 AM (43m)

npm ERR!

01/03 09:26 AM (43m)

 Exit status 1

01/03 09:26 AM (43m)

npm ERR!

01/03 09:26 AM (43m)

 
npm 

01/03 09:26 AM (43m)

ERR! Failed at the gatsby-starter-default@0.1.0 now-build script.

01/03 09:26 AM (43m)

npm ERR!

01/03 09:26 AM (43m)

 This is probably not a problem with npm. There is likely additional logging output above.

01/03 09:26 AM (43m)


01/03 09:26 AM (43m)

npm

01/03 09:26 AM (43m)

 ERR!

01/03 09:26 AM (43m)

 A complete log of this run can be found in:
npm 

01/03 09:26 AM (43m)

ERR!     /tmp/.npm/_logs/2019-01-03T15_26_27_437Z-debug.log
@jameswlane

This comment has been minimized.

Copy link

jameswlane commented Jan 5, 2019

I have tried wrapping the token with and without quotes, it still will throw a 401 when GraphQL tries and access GitHub's GraphQL API.

@jamo

This comment has been minimized.

Copy link

jamo commented Jan 5, 2019

Runtime env and build env are separate.
Try build{ env {}} instead.

Sorry for the brevity+typos. Sent from mobile

@jameswlane

This comment has been minimized.

Copy link

jameswlane commented Jan 5, 2019

@jamo Worked like a charm, thank you 👍

@jameswlane jameswlane closed this Jan 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment