"There’s no page at this address" error on Shopify Embedded App installation

Viewed 4539

I am facing a strange issue, When I install app first time on test store, installation goes smooth but after re-installation after OAuth, Shopify show me "There’s no page at this address" error.

My app submission was rejected due to this reason. I am using https://github.com/osiset/laravel-shopify library.

This is image of error.

5 Answers

@Mudasser has answered his own question. You need to delete the old Shop (from the first installation) from the database then try the install again and it will work.

If you've correctly added the app uninstalled webhook you wont have this problem.

For those using Ruby on Rails shopify_app gem:

We actually found an issue there - which might help others, to.

In: ShopifyApp::RequireKnownShop#check_shop_known

.../gems/shopify_app-18.0.2/app/controllers/concerns/shopify_app/require_known_shop.rb:24

code screenshot

We found an issue that basically the gem was just checking if the shop in DB is found by the domain name, and if it was, then it assumed that all is ok. But the app didn't get installed. So we needed to check that it can actually connect to Shopify API with the existing token - and if we cannot, then need to redirect to /login?shop=... so that it gets properly installed. Probably shopify_app gem shouldn't check that the token is valid/needs to be re-generated - but it would be nice if it did check that.

Yes, as Paul Odeon said after the user uninstalled the app, you need to delete your old shop information from your database.

I just want to mention how to do that with Laravel.

doc

on this page, you can find app/uninstalled webhook.

when the user installed the app, on the first page you should create the webhook.

in Laravel it's like this:

    $shop = Auth::user();

    $p = $shop->api()->rest('GET', '/admin/api/2021-07/webhooks.json', []);
    $webhooks = $p['body']['container']['webhooks'];

    if(count($webhooks) === 0){
        $p = $shop->api()->rest('POST', '/admin/api/2021-07/webhooks.json', [
            "webhook" => [
                "topic" => "app/uninstalled",
                "address" => env('APP_URL') . "/api/uninstalled/" . $shop->id,
                "format" => "json"
            ]
        ]);
    }

api.php:

Route::post('/uninstalled/{user_id}', 'WebhookController@uninstallAppWebhook');

controller:

public function uninstallAppWebhook($userId){
        \DB::table('users')->delete($userId);
    }

If you are using the ruby shopify gem and you are finding this message only on the reinstalling app cases, you need to set nil on the shop.shopify_token and the shop.shopify_domain fields after you receive the uninstall webhook.

On my case, I'm using the now deprecated field "shop.myshopify_domain" to save the domain when the user uninstall the app.

If the user reinstalls (even many months after), find the old SQL row and switch the rows. That way the user will find his previous data.

Related