Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There's no page at this address #602

Closed
SerhiDi opened this issue Apr 1, 2021 · 32 comments
Closed

There's no page at this address #602

SerhiDi opened this issue Apr 1, 2021 · 32 comments

Comments

@SerhiDi
Copy link

SerhiDi commented Apr 1, 2021

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.

@paulomarg
Copy link
Collaborator

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?

@SerhiDi
Copy link
Author

SerhiDi commented Apr 1, 2021

image

@SerhiDi
Copy link
Author

SerhiDi commented Apr 1, 2021

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

@SerhiDi
Copy link
Author

SerhiDi commented Apr 1, 2021

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

@paulomarg
Copy link
Collaborator

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.

@SerhiDi
Copy link
Author

SerhiDi commented Apr 7, 2021

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

@Sanj718
Copy link

Sanj718 commented Apr 8, 2021

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

@ghost
Copy link

ghost commented Apr 9, 2021

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

@paulomarg
Copy link
Collaborator

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.

@SerhiDi
Copy link
Author

SerhiDi commented Apr 12, 2021

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
Copy link
Author

SerhiDi commented Apr 12, 2021

You can try shopify deploy heroku

@SerhiDi
Copy link
Author

SerhiDi commented Apr 12, 2021

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.

@paulomarg
Copy link
Collaborator

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.

@SerhiDi
Copy link
Author

SerhiDi commented Apr 12, 2021

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?

@ghost
Copy link

ghost commented Apr 13, 2021

@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

@Sanj718
Copy link

Sanj718 commented Apr 13, 2021

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

@SerhiDi
Copy link
Author

SerhiDi commented Apr 14, 2021

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

@Sanj718
Copy link

Sanj718 commented Apr 14, 2021

@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.

@SerhiDi
Copy link
Author

SerhiDi commented Apr 14, 2021

@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.

@ismoiliy98
Copy link

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?

@keidarcy
Copy link

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

@xroussel
Copy link

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

@blacktopdev
Copy link

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

@TonySCruze
Copy link

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

@Dezital
Copy link

Dezital commented Apr 25, 2022

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

@Dezital
Copy link

Dezital commented Apr 25, 2022

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

@Sanj718
Copy link

Sanj718 commented May 4, 2022

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

image
image

@DilanAzbarga
Copy link

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

@ELBEQQAL94
Copy link

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

@Sky-bits
Copy link

Sky-bits commented Nov 4, 2022

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 i have app in express js i am getting the same Error can answer on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests