shopify-app-template-node icon indicating copy to clipboard operation
shopify-app-template-node copied to clipboard

There's no page at this address

Open SerhiDi opened this issue 4 years ago • 29 comments

After reInstall app, I see this message There's no page at this address Check the URL and try again, or use the search bar to find what you need

All ok locally, with ngrok tunnel.

Steps to reproduce the problem

  1. Create Node App
  2. Do simple changes
  3. Deploy to hosting (I used Digitalocean)
  4. Make changes on App Settings page(change URL and redirect URL to hosting urls)
  5. Install app to Development store
  6. Delete the app from the Development store
  7. Repeat Install app to Development store
  8. Get this error.

I tried submitting this app. And QA engineer wrote: Your app hasn't implemented authentication through OAuth correctly and can't be reinstalled. Review our OAuth documentation.

Node app use koa-shopify-auth - as I see the app have AccessToken, Oauth working.

What means hasn't implemented OAuth correctly? I think Shopify doesn't delete some app data from shop on app deletion.

SerhiDi avatar Apr 01 '21 11:04 SerhiDi

Hey @SerhiDi, if you've created your app using the CLI, it keeps track of which shops have installed your app (see ACTIVE_SHOPIFY_SHOPS the / route in server.js).

When the app first completes OAuth, it will subscribe to the APP_UNINSTALLED webhook, where it will mark the shop as not installed so it can be reinstalled later on.

It's likely that you're getting this error because something went wrong when handling the webhook. Could you please confirm that your server is properly receiving the webhook, and that the shop is being marked as inactive when you uninstall it?

paulomarg avatar Apr 01 '21 14:04 paulomarg

image

SerhiDi avatar Apr 01 '21 15:04 SerhiDi

@paulomarg, thanks for the reply. As I see this webhook not working.

SerhiDi avatar Apr 01 '21 15:04 SerhiDi

Install app - ROUTE ACTIVE_SHOPIFY_SHOPS {} Open app - ROUTE ACTIVE_SHOPIFY_SHOPS { 'trzdevelopment.myshopify.com': 'write_themes,write_script_tags' } Remove app - ``

SerhiDi avatar Apr 01 '21 15:04 SerhiDi

After you call Shopify.Webhooks.Registry.register, can you run console.log(response) to see if we're getting anything unexpected back?

It's also worth pointing out that it may take a few seconds for the webhook to be triggered.

paulomarg avatar Apr 07 '21 13:04 paulomarg

┃{
┃   success: true,
┃   result: {
┃     data: { webhookSubscriptionUpdate: [Object] },
┃     extensions: { cost: [Object] }
┃   }
┃ }

SerhiDi avatar Apr 07 '21 13:04 SerhiDi

I have the same issue and my app was rejected due to this problem :( any solutions please? I feel like webhook is not even triggered

Sanj718 avatar Apr 08 '21 00:04 Sanj718

I got the same issue :(. I added a logger into function: Shopify.Webhooks.Registry.process but I don't see logger function run (below image) image

ghost avatar Apr 09 '21 08:04 ghost

Hey folks, I raised this to the webhooks team, and Shopify is firing the APP_UNINSTALLED calls. I also tested the base app code, and the webhooks seem to be reaching it.

If you're not able to log the calls, that could mean that something is blocking the requests before they reach your app. We can see if the requests are actually reaching your side of things if we run ngrok manually, by doing:

  1. Run ngrok http <port> locally, copy the HTTPS address
  2. Update your app in your partners dashboard, and change the App URL and App redirection URL(s) fields
  3. Update your .env file
  4. Run the app, and perform OAuth + uninstall

You should be able to see requests being made to /webhooks in your ngrok logs a few seconds after you uninstall your app

Note: While writing point 4 above, something came to mind: whenever you reload your server, the Shopify.Webhooks.Registry object is reset, so it won't be able to process webhooks until the corresponding register call is made. So, if you're testing webhooks, please make sure to go to /auth?shop=... before trying to uninstall the app to make sure the handler has been loaded into the registry.

paulomarg avatar Apr 12 '21 16:04 paulomarg

Hello @paulomarg, thanks for your reply. As I wrote above base app working locally, with ngrok. If I create a base app, without any changes. I can install/delete it many times. I used my app few days and everything was fine.

After deployment to hosting, after adding the app link to the app setting on Shopify Partners Dashboard I'm starting to see this error.

SerhiDi avatar Apr 12 '21 16:04 SerhiDi

You can try shopify deploy heroku

SerhiDi avatar Apr 12 '21 16:04 SerhiDi

Also, I see different behavior depending on the installation method:

  1. Partners Dashboard -> Apps -> [App] -> Testing app on development store (it's button) -> Shop list selector. In this case, you open the app page and select development store where do you want to install this app. When I use this method I see There's no page at this address error almost always. But after some time, 2-3 hours, sometimes faster I can install my app. But if I delete it, I see this error again, and I must wait to try to install the app, again.

  2. Manual link. For example: shop: myshop app: myapp

If I use the installation link https://myapp.com/auth/shopify?shop=myshop.myshopify.com All working. all correct. I can delete the app, and reinstall it, and all ok.

But if I do delete/install very quickly I see the same error. I mean if I install the app from the installation link. Open Apps page, click delete the app. And very quick open installation link again https://myapp.com/auth/shopify?shop=myshop.myshopify.com.

If I do that with some intervals, few seconds, all fine.

How it's working? It's very strange implicit Shopify logic.

SerhiDi avatar Apr 12 '21 16:04 SerhiDi

Sorry, I missed the part where this was happening after deploying.

The scenario where you delete / reinstall quickly is most likely failing because the webhook wasn't called before you reinstalled the app - as I mentioned it can take a little time for the webhook to actually reach your app, as Shopify needs to process the event and fire the request.

The other scenario, where it fails for a few hours, sounds like a case where the webhook handling is failing in your app, and Shopify is retrying it. You can read more about that in our documentation on webhooks. Shopify will retry failed webhook calls once every roughly 2h to see if they go through.

paulomarg avatar Apr 12 '21 20:04 paulomarg

Ok, why webhook not working in the base NodeJS app, after deploying? How I can prevent this? Which code missed in the current version of shopify-node-app?

SerhiDi avatar Apr 12 '21 20:04 SerhiDi

@paulomarg In the tutorial, it's a specified API version, but in my code, I can't do that because Typescript warning, so I don't add that property and register still successfully, Do it affect?

I saw /webhooks called, but my await Shopify.Webhooks.Registry.process(ctx.req, ctx.res) can't be resolved. Is there anything I missed ?

Tutoiral: image

My code:

image

Warning Typescript:

image

ghost avatar Apr 13 '21 03:04 ghost

I feel like Shopify.Webhooks.Registry.process is not firing the webhookHandler which was given in afterAuth(). So, this is my possible workaround and my app was approved by shopify review today.

image

Sanj718 avatar Apr 13 '21 21:04 Sanj718

@Sanj718 hello, I tried your solution in two projects, but still seeing this error.

SerhiDi avatar Apr 14 '21 07:04 SerhiDi

@SerhiDi hello, the problem is that your shop is not beeing deleted from active_shopify_shops object. If you restart your server in heroku installation will work again since active shops object will be empty. So, can you try to console log something befores Shopify.Webhooks....Process? And see if webhook is beeing triggered via heroku logs? It should trigger after 5 seconds you have deleted the app.

If yes you shoul be able to find shop name in incoming request as i did.

Sanj718 avatar Apr 14 '21 11:04 Sanj718

@Sanj718, thank you. I added your code example and restart my remote server.

      const shop = ctx.request.header['x-shopify-shop-domain'];
      delete ACTIVE_SHOPIFY_SHOPS[shop];

      console.log(`Webhook processed, returned status code 200`);

After app deletion, I see this log: Webhook processed, returned status code 200

I tried to reinstall the app a few times, all working now. I will try to send my app to review again.

@paulomarg, can you check this code example? And make the appropriate changes in the shopify-app-node boilerplate if they are needed.

SerhiDi avatar Apr 14 '21 11:04 SerhiDi

Note: While writing point 4 above, something came to mind: whenever you reload your server, the Shopify.Webhooks.Registry object is reset, so it won't be able to process webhooks until the corresponding register call is made. So, if you're testing webhooks, please make sure to go to /auth?shop=... before trying to uninstall the app to make sure the handler has been loaded into the registry.

@paulomarg As I understand if the server restarts all information about webhooks will be deleted. What if the server goes into maintenance or restarts for other reasons? The only thing that comes to mind: We should fetch all stores from DB and reregister webhooks again. Is this the only way?

ismoiliy98 avatar Apr 14 '21 21:04 ismoiliy98

webhookHandler seems never called by Shopify.Webhooks.Registry.process

keidarcy avatar Apr 17 '21 05:04 keidarcy

Same issue here, @Sanj718 solution worked for me thank you!

xroussel avatar Apr 28 '21 09:04 xroussel

Hello there I got same error during reinstall app I am working laravel shopify app please help me

blacktopdev avatar Aug 31 '21 20:08 blacktopdev

https://community.shopify.com/c/shopify-apis-and-sdks/error-on-installing-app-quot-there-s-no-page-at-this-address/td-p/1218136 https://uhded.com/shopify-app-bridge-host-must-be-provided-error-fix https://stackoverflow.com/questions/67601949/appbridgeerror-invalid-config-host-must-be-provided https://github.com/Shopify/shopify-app-node/issues/628

you refer links, i tries and working for me

justertee avatar Dec 03 '21 14:12 justertee

Whats the resolution for this this issue where reinstalling apps under development fails with "no page at this address"?

TonySCruze avatar Apr 07 '22 16:04 TonySCruze

@Sanj718 i have tried your code as well but my issue is not resolved

Dezital avatar Apr 25 '22 10:04 Dezital

With my node app i do not receive webhook on the uninstalling of shop

Dezital avatar Apr 25 '22 10:04 Dezital

You have to re-register your webhooks everytime you reset your server.

image image

Sanj718 avatar May 04 '22 16:05 Sanj718

hi there, I was trying to activate the paypal in shopify from the payments section but it gives me this:Check the URL and try again, or use the search bar to find what you need. and i want from you a solution plz help me and thank you very much

DilanAzbarga avatar Aug 07 '22 23:08 DilanAzbarga

I see the issue come from, when you uninstalled the app webhook not remove session from database and the issue come from. Solution: try to rollback all sessions and restart you server

ELBEQQAL94 avatar Sep 26 '22 09:09 ELBEQQAL94