Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
364 stars 107 forks source link

`WebhookInstaller` job not queued after `AuthenticateShop` is executed #180

Closed bilogic closed 1 year ago

bilogic commented 1 year ago

For bug reporting only! If you're posting a feature request or discussion, please ignore.

Expected Behavior

I followed the wiki installation, my shopify app works, I expected webhooks to also get installed

Current Behavior

My shopify app fails to uninstall properly, after investigation, webhooks were not installed/registered in shopify.

Failure Information

Digging into the package, I saw that webhooks are installed by WebhookInstaller job, which is queued by AuthenticateShop. However, only ScripttagInstaller job appears in jobs table, WebhookInstaller job does not appear in jobs table.

Please help provide information about the failure if this is a bug.

Steps to Reproduce

For some reason, when AuthenticateShop.php is executed, https://github.com/Kyon147/laravel-shopify/blob/bdb7e74fe252334dbd6ea77ca51dab63fd3eb5d7/src/Actions/AuthenticateShop.php#L103-L106

ScripttagInstaller job from line 104 appears in jobs table and is subsequently dispatched. WebhookInstaller job from line 105 does not appear in jobs table.

Out of curiousity, I swapped them

// Fire the post processing jobs
call_user_func($this->dispatchWebhooksAction, $result['shop_id'], false); // now, only this appears in `jobs`
call_user_func($this->dispatchScriptsAction, $result['shop_id'], false); // this does not appear in `jobs`
call_user_func($this->afterAuthorizeAction, $result['shop_id']);

I did try to upgrade to the latest version 19.0 but it gave other errors Class "Osiset\BasicShopifyAPI\Store\Memory" not found and I decided not to pursue it

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

No errors appear in laravel.log

Please include any relevant log snippets or files here.

Kyon147 commented 1 year ago

hi @bilogic

The "Osiset\BasicShopifyAPI\Store\Memory" not found issue is because of some updates to the shopify-app config you need to make. it is mentioned in the the upgrade guide.

I've not seen this specific issue before, so I'll see if I can replicate it locally.

sp-artisan commented 1 year ago

I think I know where is the actual problem. I faced the similar issue in one of my old app while updating the package. As per I can assume @bilogic you are upgrading the package version in from the old version. And we had an upgrade in the shopify-app.php which is in the config folder.

As we have updated the namesapces from Osiset to Gnikyt. We must also updated those namespaces in the shopify-app.config file.

You will need to update these three config values to the new namespaces from the old one. image

I think @Kyon147 it will resolve Memory class issue.

bilogic commented 1 year ago

@sp-artisan

There are 2 issues here, let's not discuss them together. I'm aware of how to solve the namespace problem already. The bigger issue is the jobs not being queued.

sp-artisan commented 1 year ago

@sp-artisan

There are 2 issues here, let's not discuss them together. I'm aware of how to solve the namespace problem already. The bigger issue is the jobs not being queued.

I noticed that Osiset\BasicShopifyAPI\Store\Memory class thing from your question so I thought it would be good to post it here if somebody else finds it out it could work for them if they are upgrading.

bilogic commented 1 year ago

Yes, appreciate the help. Thank you.

Kyon147 commented 1 year ago

@bilogic i've done some tests on a new local app and can't replicate the issue. Are you on our discord, as you could DM me some more detail on your app set up so I can try and replicate it more specifically this weekend when I have time.

bilogic commented 1 year ago

Thanks for getting back. Not sure what happened, but I kept trying to clear the config cache and re-installing in shopify. Eventually the issue went away. Thank you.

Kyon147 commented 1 year ago

@bilogic glad you manage to fix it, sounds like something may have cached that was causing an issue.