Cannot connect to production strapi with gridsome

System Information
  • Strapi Version: 4.1.8
  • Operating System: macOS 12.3.1
  • Database: sqlite
  • Node Version: 14.9.1
  • NPM Version: 6.14.16
  • Yarn Version: 1.22.18

Connecting my local gridsome project to the local strapi project works fine. But once I deployed strapi to heroku, I am not able to run neither gridsome build nor gridsome develop.

I get the following error:

Gridsome v0.7.23

Initializing plugins...
Load sources - 0s
ServerError: Response not successful: Received status code 400
    at Object.exports.throwServerError (/myproject/node_modules/apollo-link-http-common/lib/index.js:23:17)
    at /myproject/node_modules/apollo-link-http-common/lib/index.js:49:21
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Strapi log:

2022-04-22T17:40:53.445210+00:00 heroku[router]: at=info method=POST path="/graphql" request_id=some-uuid fwd="some-ip" dyno=web.1 connect=0ms service=17ms status=400 bytes=1103 protocol=https

I can connect to a running v3 strapi instance deployed on heroku without any issues, that’s why I think the problem is with strapi v4