GCP deployment AppBridge error: apiKey must be provided

glv
Visitor
1 0 0

I’m deploying an embedded Shopify Node/React app on Google Cloud Run, with a Docker container. The app builds fine, and I can install it in my test store and it loads initially, but I then get an AppBridge error: 

 

 

u {name: 'AppBridgeError', message: 'APP::ERROR::INVALID_CONFIG: apiKey must be provided', action: undefined, type: 'APP::ERROR::INVALID_CONFIG', stack: 'AppBridgeError: APP::ERROR::INVALID_CONFIG: apiKey must be provided'}

 

 

The api key, secret, host and scopes are all declared as environment variables in the Cloud Run Variables & Secrets, with api key/secret getting pulled in from GCP Secret Manager. I can confirm that the key is there, because the value is returned when I console.log it from server.js and next.config.js, but regardless, I’m still getting this error.

I tried just deploying the standard Shopify Node/React app (using shopify node create) in the same way, with same results.Any ideas on how I can resolve this? Do I need to pull the env variables in earlier, like during the docker container build?

I tried just deploying the standard Shopify Node/React app (created w/ shopify node create) in the same way, with same results.

Any ideas on how I can resolve this? Do I need to pull the env variables in earlier, like during the Docker build?

Dockerfile code is: 

 

FROM node:16.10
WORKDIR /app
COPY package.json /app
RUN npm install --production --legacy-peer-deps
COPY . /app
RUN npm run build
CMD npm run start
EXPOSE 8081

 

 

Reply 1 (1)

JoeyF
Shopify Staff (Retired)
35 7 12

@glv , it seems like a problem with initializing the App Bridge client.

This page might help you find the issue. If you can't find it, can you please share your code here?
(you can search for `@shopify/app-bridge` to find the relevant files)

To learn more visit the Shopify Help Center or the Community Blog.