Closed sergeyantonuk closed 4 years ago
@sergeyantonuk The reason is only works if you remove the user from the table is probably because you do not have app uninstalled webhook setup?
See the wiki for more information.
yes, when I enabled job to handle soft deleting a shop it started to work well. Thank you a lot!
Awesome!
this is not the solution, i realized that the webhook wasn't firing anyways. So i did the following.
In shopify-app.php
'webhooks' => [
[
'topic' => env('SHOPIFY_WEBHOOK_1_TOPIC', 'app/uninstalled'),
'address' => env('SHOPIFY_WEBHOOK_1_ADDRESS', 'https://connection.e-hop.mx/api/webhook/app-uninstalled')
],
],
in /vendor/osiset/laravel-shopify/src/ShopifyApp/resources/routes.php i commented
/*
Route::post(
'/webhook/{type}',
'Osiset\ShopifyApp\Http\Controllers\WebhookController@handle'
)
//->middleware('auth.webhook')
->name('webhook');
*/
In my laravel api.php file i pasted this
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::post(
'/webhook/app-uninstalled',
'HomeController@handle'
);
//->middleware('auth.webhook'); i removed this middleware
And finally in my HomeController, i overrided the Osiset\ShopifyApp\Traits\WebhookController .
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use Auth;
use App\Jobs\AppUninstalledJob;
use Illuminate\Http\Response as ResponseResponse;
use Illuminate\Support\Facades\Response;
use Osiset\ShopifyApp\Objects\Values\ShopDomain;
class HomeController extends Controller
{
public function handle(Request $request)
{
// Get the job class and dispatch
$jobClass = 'AppUninstalledJob';
$jobData = json_decode($request->getContent());
AppUninstalledJob::dispatch(
new ShopDomain($request->header('x-shopify-shop-domain')),
$jobData
);
return Response::make('', 201);
}
}
And now it's using the webhook correctly. I know this is not the best way, but so far i just need this webhook. Is there other way to do this?
For bug reporting only! If you're posting a feature request or discussion, please ignore.
Expected Behavior
Install App
Remove App
Install App Again with No Issues:
Current Behavior
Install App
Remove App(after removing app, the user still exists in my DB,
users
table)Try to install App again:
Failure Information
When after remove App, I remove current users from DB (users table) manually, then next install will successful.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
1.Install App 2.Remove App 3.Try to install App again
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
Please include any relevant log snippets or files here.