gnikyt / laravel-shopify

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

Usage Charge Bug #1166

Closed pengbo37877 closed 2 years ago

pengbo37877 commented 2 years ago

Failure Logs


Call to a member function getId() on null

{
  "exception": {
    "class": "Error",
    "message": "Call to a member function getId() on null",
    "code": 0,
    "file": "/var/task/vendor/osiset/laravel-shopify/src/Traits/BillingController.php:112"
  }
}
rajaneeshdwivedi commented 2 years ago

Also experiencing this issue.

As an aside, the wiki contains the following snippet: $usageChargeRoute = route('billing.usage_charge', array_merge($charge, ['signature' => $signature]));

but I think it should pass $signature->toNative() or else the signature (as an object) is not packed into the query parameters when building the route and causes an InvalidArgumentException (expecting a string) in Osiset\ShopifyApp\Objects\Values\Hmac::fromNative vendor/funeralzone/valueobjects/src/Scalars/StringTrait.php:49

With this fixed, usageCharge in the BillingController trait uses $request->user()->getId() but there is no user attached to the request, so fails with "Call to a member function getId() on null".

Not sure what is the right way to resolve this.


Osiset: 17.1 Laravel: 8.83.13 php: 8.0.20

Kyon147 commented 2 years ago

@pengbo37877 @rajaneeshdwivedi - I've got a fix out for this now, so we should get it into the main branch soon enough.

Kyon147 commented 2 years ago

Duplicate of #1044