Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
88 stars 9 forks source link

Unable to post message, Recipient has Origin - on Safari Browser #127

Closed Horlarmeday closed 2 years ago

Horlarmeday commented 2 years ago

Hi!

I'm currently having an error showing up on the console of Safari browser, after loading my app via the App Bridge. The app correctly redirect back to the Shopify Admin with my app embedded in the iframe. But the error below is logged 3 times at this stage on the console.

Unable to post message to https://vi-de.myshopify.com. Recipient has origin http://localhost:3050. .

Also same thing happens on the Chrome browser. However the error message is quite different on Chrome. Here's the error displayed on Chrome.

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://localhost:3050') does not match the recipient window's origin ('https://vi-de.myshopify.com')

I've tried fixing this issue but all to no avail.

henrytao-me commented 2 years ago

Hi @Horlarmeday, this post message warning is on us. We are looking into it. If your app loads fine, you can just ignore the warning for now. We will fix it soon. 🙇

henrytao-me commented 2 years ago

This is fixed. You don't have to consume latest version of App Bridge. I close this issue for now 🙇

Horlarmeday commented 2 years ago

Hi @henrytao-me this issue is still happening on our end. Especially on Safari Browser. We keep getting the exception on the console. Unable to post message to https://vi-de.myshopify.com. Recipient has origin http://localhost:3050.

henrytao-me commented 2 years ago

@Horlarmeday, what app-bridge version are you using? A small fix in app-bridge client was added to version 3.1.4 fixing this post message issue when doing redirect back to shopify when your app on the top frame. Can you try latest version of app-bridge?