-
Notifications
You must be signed in to change notification settings - Fork 695
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
Missing host
param
#1781
Comments
Hey, sorry to hear you're having issues, and thank you for the all the details! I think the host being missing when we call
|
We use Turbolinks, so all (XHR) requests for a page load get intercepted and an We've also seen the missing JWT one time on a request triggered by Our Turbolinks setup is pretty much copy and paste from a tutorial from Shopify, when session tokens were being introduced, and we're using the latest version of AppBridge |
Hey, I touched base with the team, and this could be an intermittent issue that prevents App Bridge from getting the session token (used in Unfortunately, that is something that can happen at times (the token is fetched from the Shopify server which can have hiccups), so it'll be up to the app to retry that request from the frontend. In that case, there's not a lot we can do from the app package side. That being said, I've never run into this scenario myself (I imagine it happens only at scale), so I don't know if the request failing on the server side would be a problem. I'm assuming that if you cancel the request or handle the rejection it will ignore the redirect response, but I'll keep this issue open just in case we have to fix something. Hope this helps! |
Ok, thanks for looking into it! That makes sense. I think there might be something that can be done at the package level to help with this error. For example, inside For example, something like I don't know if that's the best or safest solution, or whether the responsibility to attempt to get the host falls on the |
Yeah, that's a good point. Unfortunately, I don't think there's a ton we can do here - if there is no session token and no host / shop params, there's really no way for us to recover as the request is essentially unsigned, and cookies won't be available for embedded apps for us to pull data from the session. I'll close this issue since there's no action we can take right now, but let me know if you spot any improvements / fixes we can make from our side and we can reopen! |
The requests with missing JWT that we've seen so far seem to at least come with the shop param, which gives us access to Though I'm not sure if that's safe. TBH, I never really understood the need for both a |
The I think you're right - there might be something we can do with this. Since there's a workaround, it may be a while until we can implement this, though. Thanks for working through this with me :) |
Issue summary
We started sporadically seeing an error
ShopifyAPI::Errors::MissingRequiredArgumentError (host argument is required)
, from ourSplashPageController#index
(it's an embedded app).Upon further investigation, I believe it occurs like this:
missing_expected_jwt?
returns true, which ends up runningredirect_to_splash_page
.host
param, because the redirect comes from a page that's already inside the iframe.SplashPageController#index
callsredirect_to(ShopifyAPI::Auth.embedded_app_url(params[:host]) + request.path, allow_other_host: true)
. Since nohost
is present, it throws an error.shopify_api
version: 21.9.0shopify_app
version: 13.4.0Expected behavior
When a merchant is logged in a navigating inside the app, a session token is always present and so all authenticated routes work as expected.
Actual behavior
In some cases,
missing_expected_jwt?
returnstrue
. Something down the stack from this method is causing issues with the token, or it's not being set correctly on the client.Steps to reproduce the problem
redirect_to_splash_page
, to simulate missing the JWT.ShopifyAPI::Errors::MissingRequiredArgumentError
The text was updated successfully, but these errors were encountered: