Issue deploying Gatsby 5.5


I have two questions actually.

I’m trying to deploy a Gatsby based website via github integration. The build fails because Gatsby requires Node 18, while the highest version available in Cloudflare is 17 when you change the NODE_VERSION environment variable. I searched online and some suggestions include using

yarn install --ignore-engines

How can I do this in the deployment?

The other question stems from what I did next, I just built the site then used direct upload. To do this I had to create another project to change the deployment type, then delete my custom domain to reassign it.

Is there anyway I can change the deployment type without having downtime for my domain?


You can’t do Node 18 (and therefore the latest Gatsby) on the current Pages build image. This will change when the new image arrives, soon™. Until then, direct upload is the way to go. You can use Github Actions to automate this so it will still deploy automatically when you push to the main branch.

You can’t change the deployment type on an existing project, unfortunately.

1 Like

Thanks for the reply.

Good thought. I’m still exploring how can I use GitHub actions to build on GitHub using node 18 then push to Cloudflare. Still new to this too.

Regarding changing deployment types. Is there any other way I can switch deployment / projects on the same domain without downtime?

Thanks again

Sadly, you can’t atomically “move” a domain from one Pages project to another (I just tried it to see if this has changed, and it has not). The fastest way, then, would be to have the new project up and ready, then delete the domain from the old one and immediately add it to the new one. Downtime in that case should™ be less than a minute.

This is the Github Action I use to deploy a site to Pages.

name: Deploy to Cloudflare Pages
run-name: ${{ }} created a deployment.

      - main
      - dev

    runs-on: ubuntu-latest
      contents: read
      deployments: write

      - uses: actions/[email protected]

      - name: Install dependencies
        run: npm ci

      - name: Build site
        run: npm run build

      - name: Publish to Cloudflare Pages
        uses: cloudflare/[email protected]
          apiToken: ${{ secrets.CF_API_TOKEN }}
          gitHubToken: ${{ secrets.GH_TOKEN }}
          accountId: 'c4181c74ba33fc8edf2d8cca0dc37bd1'
          projectName: 'igloo'
          directory: './public'

You probably need to manually deploy it the first time with wrangler to create the project. (I say “probably” because I’m not sure if this has changed.)

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.