-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: check if api is reachable during registration #56
fix: check if api is reachable during registration #56
Conversation
@@ -33,7 +33,7 @@ public function __invoke(BeforeRegistrationStartsEvent $event): void | |||
$shop = $event->getShop(); | |||
|
|||
try { | |||
$this->httpClient->request('HEAD', $shop->getShopUrl(), [ | |||
$this->httpClient->request('HEAD', sprintf("%s/api/_info/config", $shop->getShopUrl()), [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem with that is that we get always a 401 🤔. is that fine. @nsaliu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in this case when we do a HEAD
instead of POST
request 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, POST
is not allowed but even a GET
would return a HTTP 200 with the 401 error in the payload 🙈
But a HEAD
does also return a 200 without any response body and also no error 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to our awesome community! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But a HEAD does also return a 200 without any response body and also no error
Are you sure about that 🤔
When I try e.g. curl --head http://localhost:8000/api/_info/config
, i am always getting 401 😬
How did you tried that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm you're right. I'm also getting 401 as a response. I tried this is a few APP_URL
's of our customers and never had the problem with that and always got the 200 back 🙈
I will create a PR so that we also allow 401 (or something which would indicate us that the server is reachable) 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should hopefully be fixed in this PR: #58
Fixes #55
During registration, we check if the API is reachable instead of just the
APP_URL
because this could also be mapped to a sales channel which is currently in maintenance mode.