I'm working a large Laravel project which makes use of this library.
After updating from 5.5.0 → 5.5.1 my test suites began to fail with a CookieNotFoundException.
Expected behavior
Either:
My code should continue to function, or ...
The SDK version should be bumped to indicate a breaking change and provide recommendations for how to overcome the breakage, or...
The change introduced in 5.5.1 should be rolled back
Actual behavior
We are unable to update this SDK without doing a deep investigation to understand the source of the exception.
Steps to reproduce the problem
To be honest, I'm a bit new to the project, so I was not able to strip away all the details and produce a sharable reproduction (though I tried 😄)
However, I can share this code, which ran without error in version 5.5.0 but now throws a CookieNotFoundException
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Lib\CookieHandler;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Log;
use Shopify\Auth\OAuth;
use Shopify\Utils;
use Shopify\Webhooks\Registry;
use Shopify\Webhooks\Topics;
class ShopifyController extends Controller
{
public function callback(Request $request): RedirectResponse
{
$session = OAuth::callback( // <------------------ This is the line which now raises an exception
(array) $request->cookie(),
(array) $request->query(),
[CookieHandler::class, 'saveShopifyCookie'],
);
$host = strval($request->query('host'));
$shop = Utils::sanitizeShopDomain(strval($request->query('shop')));
abort_if(is_null($shop), Response::HTTP_BAD_REQUEST);
$response = Registry::register(
'/api/webhooks',
Topics::APP_UNINSTALLED,
$shop,
$session->getAccessToken() ?? '',
);
if ($response->isSuccess()) {
Log::debug("Registered APP_UNINSTALLED webhook for shop $shop");
} else {
Log::error(
"Failed to register APP_UNINSTALLED webhook for shop $shop with response body: " .
print_r($response->getBody(), true)
);
}
return redirect(Utils::getEmbeddedAppUrl($host));
}
}
Checklist
[x] I have described this issue in a way that is actionable (if possible)
Issue summary
I'm working a large Laravel project which makes use of this library. After updating from 5.5.0 → 5.5.1 my test suites began to fail with a
CookieNotFoundException
.Expected behavior
Either:
Actual behavior
We are unable to update this SDK without doing a deep investigation to understand the source of the exception.
Steps to reproduce the problem
To be honest, I'm a bit new to the project, so I was not able to strip away all the details and produce a sharable reproduction (though I tried 😄)
However, I can share this code, which ran without error in version 5.5.0 but now throws a
CookieNotFoundException
Checklist