gnikyt / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
1.24k stars 374 forks source link

install webhook not working afte April 09, 2019 | Shopify Admin API Versioning #231

Closed rakib78 closed 4 years ago

rakib78 commented 5 years ago

Please check.

gnikyt commented 5 years ago

what exactly is the issue

rakib78 commented 5 years ago

When i install app on a new development store, webhook not adding on store.

BeanMeUp commented 5 years ago

Some webhooks just don’t work on local instances. You’ll need to test on a staging or production server.

BeanMeUp commented 5 years ago

@ohmybrew Looks like I'm also having this issue. With version 4.2.1, none of my jobs are firing. They're not even failing.

gnikyt commented 5 years ago

@fyroc Odd both of yours are failing, especially on 4.2 since that's before any major changes I've introduced with the new user sessions and such.

whats failing exactly do you know? is the the job not firing itself, or an API call? what version of Laravel is it running on? maybe I can try and replicate it.

BeanMeUp commented 5 years ago

@ohmybrew sorry, I'm on 6.0 not 4.2, I was looking at my working app. It's hard to debug.. usually I can see what's happening by turning off my listener and reviewing the jobs in the jobs table. However, the web hooks are not even getting to the jobs table.

 "php": "^7.1.3",
  "laravel/framework": "5.7.*",
  "ohmybrew/laravel-shopify": "^6.0.0",
SHOPIFY_SHOP_REDACT="https://boxsy.loc/webhook/shop-redact"
SHOPIFY_CUSTOMERS_REDACT="https://boxsy.loc/webhook/customers-redact"
SHOPIFY_WEBHOOK_1_TOPIC="app/uninstalled"
SHOPIFY_WEBHOOK_1_ADDRESS="https://boxsy.loc/webhook/app-uninstalled"

shopify-app.php https://gist.github.com/fyroc/733744827c91867dd8f031a37bda7870

Edit:

I even added these lines to my .env since theses were new to 6.0

AFTER_AUTHENTICATE_JOB_QUEUE=default
WEBHOOKS_JOB_QUEUE=default
BeanMeUp commented 5 years ago

@ohmybrew did this help at all? Am I going to need to downgrade to 4.2?

gnikyt commented 5 years ago

@fyroc Thanks for the info. Going to spin up a fresh instance tonight and see whats up. Flow-wise I see nothing wrong at the moment... line 71 in Traits/AuthControllerTrait fires the jobs on auth.

I'll get to the bottom of it. And theres no errors in log files or anything like a 500 error?

BeanMeUp commented 5 years ago

@ohmybrew I get nothing. If you can't replicate it via a fresh install, I suggest starting with 4.2.1 and updating to 6.0 manually, since that was my process.

gnikyt commented 5 years ago

Yup good idea.On May 7, 2019 13:26, Cory Fail notifications@github.com wrote:@ohmybrew I get nothing. If you can't replicate it via a fresh install, I suggest starting with 4.2.1 and updating to 6.0 manually, since that was my process.

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

gnikyt commented 5 years ago

@fyroc On initial try of fresh install I'm able to see the webhook request go through hmm.

Can you add

        /*
    |--------------------------------------------------------------------------
    | Shopify API Grant Mode
    |--------------------------------------------------------------------------
    |
    | This option is for the grant mode when authenticating.
    | Default is "offline", "per-user" is available as well.
    | Note: Install will always be in offline mode.
    |
    */

    'api_grant_mode' => env('SHOPIFY_API_GRANT_MODE', 'offline'),

        /*
    |--------------------------------------------------------------------------
    | Shopify API Version
    |--------------------------------------------------------------------------
    |
    | This option is for the app's API version string.
    | Use "YYYY-MM" or "unstable". Refer to Shopify's documentation
    | on API versioning for the current stable version.
    |
    */

    'api_version' => env('SHOPIFY_API_VERSION', '2019-04'),

And see if that helps?

BeanMeUp commented 5 years ago

@ohmybrew I've done the following with no joy.

I'm still not getting any jobs firing

BeanMeUp commented 5 years ago

I ended up just downgrading to 4.2.1

gnikyt commented 5 years ago

Alright odd. I'm going to keep digging on this one

BeanMeUp commented 5 years ago

It could have been something in the boilerplate I made, I'm not sure. What I did to fix it was to just make a copy of my working 4.2.1 app and replaced the app components with the new app. I'll try to upgrade to 7.0 later to see if it was something in the boilerplate, or it's indeed something with the package update.

gnikyt commented 5 years ago

I'm going to give the upgrade path a try and see what happens as well.

gnikyt commented 5 years ago
{
   "webhooks":[
      {
         "id":388433707050,
         "address":"https:\/\/laravel-shopify.local\/webhook\/app-uninstalled",
         "topic":"app\/uninstalled",
         "created_at":"2019-05-08T09:00:58-04:00",
         "updated_at":"2019-05-08T09:00:58-04:00",
         "format":"json",
         "fields":[

         ],
         "metafield_namespaces":[

         ],
         "api_version":"2019-04"
      }
   ]
} 

Fresh install is the response I get when calling /admin/webhooks.json using the access token. Its being added.

Will attempt a 4.2 and follow through with an upgrade to see what happens, it may be an issue existing in there yeah

gnikyt commented 5 years ago

Okay so I installed

However, I am using the sync driver ATM on my Docker instance. What are you using for the jobs @fyroc ? I am going to patch Redis in now shortly to give it another try to see if its a queue issue.

BeanMeUp commented 5 years ago

I'm using database for testing so I could see the job in the jobs table. I never saw it inserted. Now I'm wondering if it's another package breaking it. I'm betting it could be Voyager.

gnikyt commented 5 years ago

Thanks for the info, I'm going to match what you have and give database a go for my queue instead then and see what happens.

gnikyt commented 5 years ago

@fyroc Hmm database had luck as well (https://i.imgur.com/sdvpk3o.png). Anything else you can think of that might be the source?

gnikyt commented 5 years ago

@fyroc are you sure it's not reaching your job table? I'm wondering if it's some odd error in the actual API call like the token not being passed in properly or something

BeanMeUp commented 5 years ago

It is definitely not.

gnikyt commented 5 years ago

@fyroc Can you confirm for me again the versions, I want to try and target what you have.

Laravel version, and PHP version.

BeanMeUp commented 5 years ago

Laravel: 5.7 & 5.8 PHP 7.3.2

gnikyt commented 5 years ago

@fyroc Sorry still having trouble with this... investigating still on what to do.

gnikyt commented 5 years ago

@fyroc there was a bug with the session check which was patched last week, it had a case where it would skip over the firing of the webhook manager. Maybe give it a try and see if its now OK on the new patch?

BeanMeUp commented 5 years ago

I'll have to check. I'm using an older version for this package at the moment.

ncpope commented 5 years ago

@fyroc @ohmybrew

Any updates on this? I'm using an older version and would like to upgrade but waiting on the issues to get resolved before moving forward.

chandlerwilcox88 commented 5 years ago

I am using laravel 5.8 and the latest "ohmybrew/laravel-shopify": "^9.1"

I have gone into the OhMyBrew\ShopifyApp\Services\WebhookManager and logged if they are being created and the function fires and everything looks good but when I look at my xhr requests on the server I don't see them sending a request to shopify so maybe that is where things are going wrong?

Update: 9/15/19

Webhooks are spontaneously working. I think it might be something with ngrok based on that is the only thing that has changed in my stack.

BeanMeUp commented 5 years ago

I haven't tested it. I've moved away from creating new Shopify apps.

StefanNeuser commented 5 years ago

@fyroc do you want to share why you moved away?

BeanMeUp commented 5 years ago

@StefanNeuser ever since they updated the app store, downloads have decreased and the quality of the clients have decreased as well.

jesephan commented 5 years ago

in my end, the webhook no longer works due to messed up api_scopes values in the shopify-app.php configuration file. Like if you want to add webhook for orders/created then make sure to add read_orders in your api_scopes