Search code examples
phpreactjslaravelshopify-appshopify-api

Shopify: There’s no page at this address Check the URL and try again, or use the search bar to find what you need


I’m new to Shopify App development. I’ve developed an app using a php template provided by shopify. It’s using Laravel & React. It’s https://github.com/Shopify/shopify-app-template-php/tree/cli_three

When I execute npm run dev, the app is running in the development store.

Then, I deployed my app on the AWS server using one domain (e.g: sub.mydomain.com).

Before deployment: I have build the frontend using: SHOPIFY_API_KEY=MY_API_KEY npm run build I’ve run composer build too.

After that, I tried to install the app. While doing so, It’s authenticating and saving the session in the database too. But, on redirecting after authentication, it’s not working,

First, It’s giving this error on console:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://mystore.myshopify.com') does not match the recipient window's origin ('https://sub.mydomain.net').

And then after redirect, it’s displaying:

enter image description here

Along with console error:

GET https://mystore.myshopify.com/admin/apps/40aac89c4c56232219d0f1f75a1f2ae7/?hmac=68236dae6688aafd05925cf409dfff0965236542401999f8ff47decd8b942d&host=cW9kZWFuYWx5dGljcy5JKihgZnkuY29tL2FkbWlu&shop=mystore.myshopify.com&timestamp=1657698129 404


Solution

  • About that console error you need to add this header on top of the page in views top_level.blade.php

    <?php
      $domain= $shop ?? Auth::user()->name ; ; // loged-in shopify store url example.myshopify.com
      header("Content-Security-Policy: frame-ancestors https://".$domain." "."https://admin.shopify.com");
    ?>
    

    This will resolve the does not match the recipient window's origin error.

    After that try to open the app again or you can remove the entry from db and install the app again hope that will help.