Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Uninstall job doesn't work #427

Closed
Jamesking56 opened this issue Mar 22, 2020 · 9 comments
Closed

Uninstall job doesn't work #427

Jamesking56 opened this issue Mar 22, 2020 · 9 comments
Assignees
Labels
bug Bug with the code

Comments

@Jamesking56
Copy link
Contributor

Jamesking56 commented Mar 22, 2020

Expected Behavior

When removing app from Shopify store, the uninstalled job is called and sets deleted_at in the users table.

Current Behavior

Shopify app uninstall job is called, but errors with:

Argument 1 passed to Osiset\ShopifyApp\Messaging\Jobs\AppUninstalledJob::__construct() must be an instance of Osiset\ShopifyApp\Objects\Values\ShopId, instance of Osiset\ShopifyApp\Objects\Values\ShopDomain given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php on line 16 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 1 passed to Osiset\\ShopifyApp\\Messaging\\Jobs\\AppUninstalledJob::__construct() must be an instance of Osiset\\ShopifyApp\\Objects\\Values\\ShopId, instance of Osiset\\ShopifyApp\\Objects\\Values\\ShopDomain given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php on line 16 at /var/www/html/vendor/osiset/laravel-shopify/src/ShopifyApp/Messaging/Jobs/AppUninstalledJob.php:54)

Failure Information

The job file setup by php artisan vendor:publish --tag=shopify-jobs is also wrong. My job class is as follows:

<?php

declare(strict_types=1);

namespace App\Jobs;

final class AppUninstalledJob extends \Osiset\ShopifyApp\Messaging\Jobs\AppUninstalledJob
{
}

Steps to Reproduce

  1. Create uninstall job following wiki
  2. Install app to Shopify store
  3. Uninstall app from Shopify store
  4. See error in Laravel logs
  5. See deleted_at not set

Context

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

  • Package Version: v11.1.0
  • Laravel Version: v6.17.1
  • PHP Version: v7.3.16
  • Using a toolset (Docker, Laradock, Vagrant, etc.): Docker (Vessel)

Failure Logs

See above.

@gnikyt
Copy link
Owner

gnikyt commented Mar 25, 2020

Thanks... fixing...

@gnikyt gnikyt self-assigned this Mar 25, 2020
@gnikyt gnikyt added fix-in-progress In progress bug Bug with the code labels Mar 25, 2020
@gnikyt gnikyt added status-resolved and removed fix-in-progress In progress labels Mar 25, 2020
@gnikyt
Copy link
Owner

gnikyt commented Mar 25, 2020

Please give v11.2.0 a go, seems to solve it.

@Jamesking56
Copy link
Contributor Author

@osiset v11.2.0 doesn't seem to be available on Packagist...

@ardnor
Copy link

ardnor commented Mar 29, 2020

@osiset still we have an issue in uninstalling the app kindly see below screenshot

image

This screenshot is from my production server.

This is the version of the package: ^11.1

Thanks and have a great day :)

@danbergan
Copy link

I think the AppUninstalledJob should extend \Osiset\ShopifyApp\Messaging\Jobs\AppUninstalledJob rather than \Osiset\ShopifyApp\Jobs\AppUninstalledJob.

I think that's a typo in:
\Osiset\ShopifyApp\resources\jobs\AppUninstalledJob.php - on line 5.

@danbergan
Copy link

After fixing the above AppUninstallJob path, I'm getting this error:

production.ERROR: Too few arguments to function App\Jobs\AppUninstalledJob::__construct(), 2 passed in /var/www/html/shopifyapp/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php on line 16 and exactly 3 expected {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Too few arguments to function App\Jobs\AppUninstalledJob::__construct(), 2 passed in /var/www/html/shopifyapp/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php on line 16 and exactly 3 expected at /var/www/html/shopifyapp/app/Jobs/AppUninstalledJob.php:20)

It looks like and error here:
/osiset/laravel-shopify/src/ShopifyApp/Traits/WebhookController.php(33)

The uninstall job is expecting a third parameter - callable $cancelCurrentPlanAction which is not provided.

@gnikyt
Copy link
Owner

gnikyt commented Apr 2, 2020

@danbergan Thanks, will try to resolve this.

@gnikyt
Copy link
Owner

gnikyt commented Apr 2, 2020

Solved, will release shortly.

@DenisYakimchuk
Copy link

The issue is still reproducing with the next setup:

  • Package Version: v12.1.0
  • Laravel Version: v7.25.0
  • PHP Version: v7.3.20

Declaration of App\Jobs\AppUninstalledJob::handle(App\Jobs\IShopCommand $shopCommand, App\Jobs\IShopQuery $shopQuery, App\Jobs\CancelCurrentPlan $cancelCurrentPlanAction): bool should be compatible with Osiset\ShopifyApp\Messaging\Jobs\AppUninstalledJob::handle(Osiset\ShopifyApp\Contracts\Commands\Shop $shopCommand, Osiset\ShopifyApp\Contracts\Queries\Shop $shopQuery, Osiset\ShopifyApp\Actions\CancelCurrentPlan $cancelCurrentPlanAction): bool {"exception":"[object] (ErrorException(code: 0): Declaration of App\\Jobs\\AppUninstalledJob::handle(App\\Jobs\\IShopCommand $shopCommand, App\\Jobs\\IShopQuery $shopQuery, App\\Jobs\\CancelCurrentPlan $cancelCurrentPlanAction): bool should be compatible with Osiset\\ShopifyApp\\Messaging\\Jobs\\AppUninstalledJob::handle(Osiset\\ShopifyApp\\Contracts\\Commands\\Shop $shopCommand, Osiset\\ShopifyApp\\Contracts\\Queries\\Shop $shopQuery, Osiset\\ShopifyApp\\Actions\\CancelCurrentPlan $cancelCurrentPlanAction): bool at ../app/Jobs/AppUninstalledJob.php:10)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug with the code
Projects
None yet
Development

No branches or pull requests

5 participants