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.
7
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
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:api.php:
controller:
But what if the scenario is this, you cannot create a webhook before installing app
Check this one:
https://github.com/osiset/laravel-shopify/issues/1071
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.
This happened with our sales channel too and the reason was that shopify’s "APP_UNINSTALLED" webhook does not get called properly or some delay happens so the session_token does not get cleared (which you might be doing in that webhook handler). And because of using an expired token, you end up on that page.
How we fixed it was we retrieve the saved session from session storage and use it to hit any shopify admin api and if that fails with a 401 or 403 error then we assume that it is an expired token and clear it.
Something like this:
I realized that I was getting that error because the name of the app was the same as the name of an app that i had installed previously.
I solved this by simply changing the name of the app from.
micro-app
tomicro-app2
.once
micro-app2
was installed, then I tried to installmicro-app
again, and it work fine