gatsbyjs / gatsby-starter-landing-page

Create custom landing pages using Gatsby and Contentful
https://landingpagestarter.gatsbyjs.io/
57 stars 26 forks source link

Can't start the app while following the README #45

Closed mbrydak closed 1 year ago

mbrydak commented 2 years ago

While following through with the instructions stated in readme, seemingly gatsby-provision works fine (as stated below)

❯ yarn gatsby-provision
yarn run v1.22.17
$ gatsby-provision-contentful --contentful-data-path='./.contentful/landing-page-model-and-content.json'

    To set up this project you will need your Contentful Space ID
    and API access tokens. Please use an empty Contentful space for this.
    You can find all the needed information in your Contentful space under:
    app.contentful.com -> Space Settings -> API keys
    The Content Delivery API Token
      will be used to ship published production-ready content in your Gatsby app.
    The Content Management API Token
      will be used to import and write data to your space.

    Ready? Let's do it! πŸŽ‰

? Your Space ID XXXXXXXXXXXXX
? Your Content Delivery API access token XXXXXXXXXXXXX
? Your Content Management API access token XXXXXXXXXXXXX
Writing config file...
Config file /home/max/Development/GitHub/nullops-landing-page/node_modules/.env.development written
Config file /home/max/Development/GitHub/nullops-landing-page/node_modules/.env.production written
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ The following entities are going to be imported: β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Content Types                  β”‚ 4               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Tags                           β”‚ 0               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Editor Interfaces              β”‚ 4               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Entries                        β”‚ 44              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Assets                         β”‚ 14              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Locales                        β”‚ 1               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Webhooks                       β”‚ 1               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  βœ” Validating content-file
  βœ” Initialize client (1s)
  βœ” Checking if destination space already has any content and retrieving it (2s)
  βœ” Apply transformations to source data (1s)
  βœ” Push content to destination space
    βœ” Connecting to space (1s)
    βœ” Importing Locales (1s)
    βœ” Importing Content Types (1s)
    βœ” Publishing Content Types (3s)
    βœ” Importing Tags (1s)
    βœ” Importing Editor Interfaces (2s)
    ↓ Uploading Assets [skipped]
    βœ” Importing Assets (6s)
    βœ” Publishing Assets (7s)
    βœ” Archiving Assets (1s)
    βœ” Importing Content Entries (7s)
    βœ” Publishing Content Entries (20s)
    βœ” Archiving Entries (1s)
    βœ” Creating Web Hooks (1s)
Finished importing all data
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Imported entities      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€
β”‚ Locales           β”‚ 1  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Content Types     β”‚ 4  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Tags              β”‚ 0  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Editor Interfaces β”‚ 4  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Assets            β”‚ 14 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Published Assets  β”‚ 14 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Archived Assets   β”‚ 0  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Entries           β”‚ 44 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Published Entries β”‚ 44 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Archived Entries  β”‚ 0  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€
β”‚ Webhooks          β”‚ 1  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”˜
The import took 1 minute (45s)

The following 0 errors and 4 warnings occurred:

20:06:15 - Rate limit error occurred. Waiting for 1547 ms before retrying...
20:06:15 - Rate limit error occurred. Waiting for 1559 ms before retrying...
20:06:15 - Rate limit error occurred. Waiting for 1571 ms before retrying...
20:06:15 - Rate limit error occurred. Waiting for 1632 ms before retrying...
The import was successful.
All set! You can now run yarn start to see it in action.
Done in 103.40s.

But unfortunately – following through with yarn start results in an error

❯ yarn start    
yarn run v1.22.17
$ gatsby develop
success compile gatsby files - 1.148s

 ERROR #10123  CONFIG

We encountered an error while trying to load your site's gatsby-config. Please
fix the error and try again.

  Error: Contentful spaceId and the access token need to be provided. Received: 
  {}

  - gatsby-config.js:18 Object.<anonymous>
    /home/max/Development/GitHub/nullops-landing-page/gatsby-config.js:18:9

  - loader:1103 Module._compile
    node:internal/modules/cjs/loader:1103:14

  - loader:1155 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1155:10

  - loader:981 Module.load
    node:internal/modules/cjs/loader:981:32

  - loader:822 Function.Module._load
    node:internal/modules/cjs/loader:822:12

  - loader:1005 Module.require
    node:internal/modules/cjs/loader:1005:19

  - helpers:102 require
    node:internal/modules/cjs/helpers:102:18

  - get-config-file.ts:53 getConfigFile
    [nullops-landing-page]/[gatsby]/src/bootstrap/get-config-file.ts:53:22

  - index.ts:22 loadConfig
    [nullops-landing-page]/[gatsby]/src/bootstrap/load-config/index.ts:22:50

  - initialize.ts:180 initialize
    [nullops-landing-page]/[gatsby]/src/services/initialize.ts:180:24

not finished load gatsby config - 0.112s

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The .env.development file looks like it's not properly created.

❯ cat .env.development 

# To enable previews locally, uncomment the next line:
# CONTENTFUL_HOST="preview.contentful.com"
KyleAMathews commented 2 years ago

You need to add to the .env.development the contentful space id and access token

mbrydak commented 2 years ago

Ok, thanks, what I understood from the output was, that expected behavior is for the script to fully create the .env.development file

On Sun, Sep 18, 2022, 00:04 Kyle Mathews @.***> wrote:

You need to add to the .env.development the contentful space id and access token

β€” Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby-starter-landing-page/issues/45#issuecomment-1250147180, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANTHNWNMOEN5QM7ASAQSVY3V6Y55LANCNFSM6AAAAAAQPDHQDI . You are receiving this because you authored the thread.Message ID: @.***>

aghreed commented 2 years ago

@mbrydak you are correct, the expected behavior for running gatsby-provision in a local context is for an environment variable file to be created on your behalf from the values provided when prompted by the script.

Thanks for bringing to our attention. I'll look into the issue but you can unblock yourself in the meantime by doing what Kyle suggested and manually adding those values to your .env.development file.

aghreed commented 2 years ago

@mbrydak finally got around to this, and it looks like there was a pathing issue with where the .env.* files are created. Would you be able to confirm that those files were created a directory "up" from your project?

augustweinbren commented 1 year ago

@aghreed I had this same issue, and ended up needing to resolve it with the following command: cp node_modules/.env.development ./.env.development Leaving here for future users.

aghreed commented 1 year ago

Thanks for everyone's patience!

I've gone ahead and addressed this issue and issued PRs for all the repos that consume gatsby-provision-contentful β€” not just this one.

I'll be closing out the issue once https://github.com/gatsbyjs/gatsby-starter-landing-page/pull/48 is merged.