AppBridgeError: APP::ERROR::INVALID_CONFIG: not a valid host, please use the value provided by Shopi

sohailbukhari
New Member
2 0 2

AppBridgeError: APP::ERROR::INVALID_CONFIG: not a valid host, please use the value provided by Shopify

I have upgraded @Shopify/app-bridge-react from v1.30.0 to v2.0.2-alpha.2

shopify throws me the error for host param 

My CODE : 
  
    const config = { apiKey: API_KEY, host: HOST, shopOrigin, forceRedirect: true };
 
i have already tried it with resolving with ngrok host not working either.
Replies 5 (5)
jeff75
Shopify Staff
Shopify Staff
2 0 0

Hey @sohailbukhari -

Can you try passing your config without passing the shopOrigin parameter?  Like below:

const config = { apiKey: API_KEY, host: HOST, forceRedirect: true };

 
Thanks,
Jeff

xosblo91
New Member
1 0 0

Hi @jeff75 

How would I get the host in the first place?

Thank you

sheldonn
Shopify Staff
Shopify Staff
1 0 0

The Shopify admin provides the host parameter as part of the app URL when loading your embedded app.

Example:

https://example.org/?hmac={hmac}&host={base64_encoded_hostname}&session={session}&shop={shop_origin}&timestamp=1409617544

 

You can learn more about this parameter in our Migrate your app from Shopify App Bridge 1.x to Shopify App Bridge 2.0 guide

rohit_martires
Shopify Partner
49 3 2

but when u install a draft app by clicking (from the app listing page)

more actions >> Test on development store >> install app

it redirects to a link like 

https://foo.vercel.app/?hmac=bar&shop=buz.myshopify.com&timestamp=163750xxxx

no host param is provided.

it works fine when i try installing from the link provided by the shopify-cli

i.e. 

https://foo.vercel.app/auth?shop=bor

 

not sure what to do

sagar_at_avyya
Shopify Partner
16 1 5

You are right, when you install the app from

more actions >> Test on development store >> install app

the URL does not have the host parameter, I added the following in the Home controller to fix this in a rails app using the Shopify app engine:

 

redirect_to "/login?shop=#{current_shopify_domain}" and return unless params[:host]

 

This initiates the login procedure using shopify_app gem and the flows works as expected

Sagar @ Avyya - Modern Sales booster
https://apps.shopify.com/avyya