Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Build fails on Heroku #14

Closed
visualcookie opened this issue Jul 2, 2019 · 6 comments
Closed

Build fails on Heroku #14

visualcookie opened this issue Jul 2, 2019 · 6 comments
Labels
discussion Not directly related to this project's codebase

Comments

@visualcookie
Copy link

Trying to deploy my Gatsby project on Heroku but it fails. Seems like it even can't log in.

-----> Build

       Running build (yarn)

       yarn run v1.17.2

       $ gatsby build

       ╔════════════════════════════════════════════════════════════════════════╗

       ║                                                                        ║

       ║   Gatsby has started collecting anonymous usage analytics              ║

       ║   to help improve Gatsby for all users.                                ║

       ║                                                                        ║

       ║   If you'd like to opt-out, you can use `gatsby telemetry --disable`   ║

       ║   To learn more, checkout https://gatsby.dev/telemetry                 ║

       ║                                                                        ║

       ╚════════════════════════════════════════════════════════════════════════╝

       

lscpu: failed to determine number of CPUs: /sys/devices/system/cpu/possible: No such file or directory

       �[2K�[1A�[2K�[G⠋ open and validate gatsby-configs

       �[2K�[1A�[2K�[Gsuccess open and validate gatsby-configs - 0.008 s

       ⠋ open and validate gatsby-configs

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ load plugins

       �[2K�[1A�[2K�[Gsuccess load plugins - 0.740 s

       ⠋ load plugins

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ onPreInit

       �[2K�[1A�[2K�[Gsuccess onPreInit - 0.008 s

       ⠋ onPreInit

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ delete html and css files from previous builds

       �[2K�[1A�[2K�[Gsuccess delete html and css files from previous builds - 0.010 s

       ⠋ delete html and css files from previous builds

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ initialize cache

       �[2K�[1A�[2K�[Gsuccess initialize cache - 0.010 s

       ⠋ initialize cache

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ copy gatsby files

       �[2K�[1A�[2K�[Gsuccess copy gatsby files - 0.031 s

       ⠋ copy gatsby files

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ onPreBootstrap

       �[2K�[1A�[2K�[Gsuccess onPreBootstrap - 0.015 s

       ⠋ onPreBootstrap

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ source and transform nodes

       �[2K�[1A�[2K�[G⠙ source and transform nodes

       �[2K�[1A�[2K�[G⠹ source and transform nodes

       �[2K�[1A�[2K�[G⠸ source and transform nodes

       �[2K�[1A�[2K�[G⠼ source and transform nodes

       �[2K�[1A�[2K�[G⠴ source and transform nodes

       �[2K�[1A�[2K�[G⠦ source and transform nodes

       �[2K�[1A�[2K�[G⠧ source and transform nodes

       �[2K�[1A�[2K�[G⠇ source and transform nodes

       �[2K�[1A�[2K�[G⠏ source and transform nodes

       �[2K�[1A�[2K�[G⠋ source and transform nodes

       �[2K�[1A�[2K�[G⠙ source and transform nodes

       �[2K�[1A�[2K�[G⠹ source and transform nodes

       �[2K�[1A�[2K�[G⠸ source and transform nodes

       �[2K�[1A�[2K�[G⠼ source and transform nodes

       �[2K�[1A�[2K�[G⠴ source and transform nodes

       �[2K�[1A�[2K�[G⠦ source and transform nodes

       �[2K�[1A�[2K�[G⠧ source and transform nodes

       �[2K�[1A�[2K�[G⠇ source and transform nodes

       �[2K�[1A�[2K�[G⠏ source and transform nodes

       �[2K�[1A�[2K�[G⠋ source and transform nodes

       �[2K�[1A�[2K�[G⠙ source and transform nodes

       �[2K�[1A�[2K�[G⠹ source and transform nodes

       �[2K�[1A�[2K�[G⠸ source and transform nodes

       �[2K�[1A�[2K�[G⠼ source and transform nodes

       �[2K�[1A�[2K�[G⠴ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Started logging for gatsby-source-directus7.

       ⠴ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Directus data fetcher initializing...

       ⠴ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info targetStatus is: draft

       ⠴ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: success Connected to Directus!

       ⠴ source and transform nodes

       �[2K�[1A�[2K�[G⠦ source and transform nodes

       �[2K�[1A�[2K�[G⠧ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: error Error logging in to Directus:  { code: 6, message: 'Method Not Allowed' }

       ⠧ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Failed to log in. Attempting to use public permission for Directus API...

       ⠧ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Fetching Directus file data...

       ⠧ source and transform nodes

       �[2K�[1A�[2K�[G⠇ source and transform nodes

       �[2K�[1A�[2K�[G⠏ source and transform nodes

       �[2K�[1A�[2K�[G⠋ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: error gatsby-source-directus: Error while fetching files:  { code: 300,

         message: 'Reading items from "directus_files" collection was denied' }

       ⠋ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: success Found 0 files from Directus.

       ⠋ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Downloading Directus files to Gatsby build cache...

       ⠋ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: success Downloaded all 0 files from Directus!

       ⠋ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Fetching Directus Collection data...

       ⠋ source and transform nodes

       �[2K�[1A�[2K�[G⠙ source and transform nodes

       �[2K�[1A�[2K�[G⠹ source and transform nodes

       �[2K�[1A�[2K�[GError fetching Collections:  { code: 300,

         message:

          'Reading items from "directus_collections" collection was denied' }

       ⠹ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Fetching Directus Items data...

       ⠹ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Fetching Directus Relations data...

       ⠹ source and transform nodes

       �[2K�[1A�[2K�[G⠸ source and transform nodes

       �[2K�[1A�[2K�[G⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: error Error fetching Relations:  { code: 300,

         message:

          'Reading items from "directus_relations" collection was denied' }

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: success Retrieved all data from Directus!

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Directus data processing starting...

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Mapping Directus relations to Items...

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Cleaning junction collections...

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Mapping Directus files to Items...

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Generating GraphQL nodes...

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: success All done!

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[GGSD7: info Ended logging for gatsby-source-directus7.

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[Gwarn The gatsby-source-directus7 plugin has generated no Gatsby nodes. Do you need it?

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[Gsuccess source and transform nodes - 3.127 s

       ⠼ source and transform nodes

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ building schema

       �[2K�[1A�[2K�[G⠙ building schema

       �[2K�[1A�[2K�[G⠹ building schema

       �[2K�[1A�[2K�[Gsuccess building schema - 0.449 s

       ⠹ building schema

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ createPages

       �[2K�[1A�[2K�[GGraphQL query returned error: TypeError: Cannot read property 'allDirectusJob' of undefined

       ⠋ createPages

       �[2K�[1A�[2K�[Gsuccess createPages - 0.025 s

       ⠋ createPages

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ createPagesStatefully

       �[2K�[1A�[2K�[G⠙ createPagesStatefully

       �[2K�[1A�[2K�[Gsuccess createPagesStatefully - 0.098 s

       ⠙ createPagesStatefully

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ onPreExtractQueries

       �[2K�[1A�[2K�[Gsuccess onPreExtractQueries - 0.006 s

       ⠋ onPreExtractQueries

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ update schema

       �[2K�[1A�[2K�[Gsuccess update schema - 0.166 s

       ⠋ update schema

       �[2K�[1A�[2K�[G

       �[2K�[1A�[2K�[G⠋ extract queries from components

       �[2K�[1A�[2K�[G⠙ extract queries from components

       �[2K�[1A�[2K�[G⠹ extract queries from components

       �[2K�[1A�[2K�[G

        ERROR

       

       GraphQL Error Encountered 3 error(s):

       - Unknown field 'allDirectusJob' on type 'Query'. Source: document `tmpBuild9Ac0F1E943686D286E71E4881394D538SrcSectionsCareerOpenPositionsIndexJs4246648944` file: `GraphQL request`

       

         GraphQL request:3:15

         2 |             query {

         3 |               allDirectusJob {

           |               ^

         4 |                 edges {

       - Unknown field 'allDirectusTeam' on type 'Query'. Source: document `tmpBuild9Ac0F1E943686D286E71E4881394D538SrcSectionsCompanyOurTeamIndexJs2571343049` file: `GraphQL request`

       

         GraphQL request:3:11

         2 |         query {

         3 |           allDirectusTeam {

           |           ^

         4 |             edges {

       - Unknown field 'directusJob' on type 'Query'.

       

             file: /tmp/build_9ac0f1e943686d286e71e4881394d538/src/templates/career/index.js

       

       

       

       

       ⠹ extract queries from components

error Command failed with exit code 1.

       info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

-----> Build failed

       

       We're sorry this build is failing! You can troubleshoot common issues here:

       https://devcenter.heroku.com/articles/troubleshooting-node-deploys

       

       Some possible problems:

       

       - Node version not specified in package.json

         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

       

       Love,

       Heroku

       

 !     Push rejected, failed to compile Node.js app.

 !     Push failed


@Jonesus
Copy link
Owner

Jonesus commented Jul 2, 2019

Hi! I haven't tried deploying the plugin anywhere but self hosted solutions so I'd need more information about how you host your Directus in relation to the frontend (which is apparently in Heroku), and preferably some info about your gatsby-config.js's gatsby-source-directus7 fields

@Jonesus Jonesus added the discussion Not directly related to this project's codebase label Jul 2, 2019
@visualcookie
Copy link
Author

Directus is hosted on a DigitalOcean LEMP server setup, whereas the Gatsby site is hosted on Heroku like the docs explained.

Config shared on #12

@Jonesus
Copy link
Owner

Jonesus commented Jul 3, 2019

Are you able to access the API manually with curl or a browser? The relevant line in the build log seems to be

GGSD7: error Error logging in to Directus:  { code: 6, message: 'Method Not Allowed' }

Which I think would point towards the API itself not being accessible either at all or from the Heroku instance. Does the DigitalOcean have some kind of limitations on what requests it accepts, like only GET for instance?

@visualcookie
Copy link
Author

Sent a post request to _/auth/authenticate resulting in a success with the data returned.

I've not changed the setup of the DO server except for adding the NGINX server block.

@Jonesus
Copy link
Owner

Jonesus commented Jul 4, 2019

Hmm, I'll have to spin up a Heroku instance for testing myself at some point, might not have time for a proper investigation until next week though...

@visualcookie
Copy link
Author

I fixed it. It was a weird issue. I had to change the the url to https. Still weird, that it worked while running yarn start but not on the server.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion Not directly related to this project's codebase
Projects
None yet
Development

No branches or pull requests

2 participants