Problem Description
I am developing a Shopify Remix App, and I’m encountering an intermittent issue with the shopify.authenticate.admin() method. Occasionally, around 5% of the time, the following error occurs:
{
status: 500,
statusText: '',
internal: false,
data: "Detected call to shopify.authenticate.admin() from configured login path ('/auth/login'), please make sure to call shopify.login() from that route instead."
}
This error randomly occurs on different pages of my app where shopify.authenticate.admin() is called. It is not tied to any specific page or action. The strange part is that simply refreshing the browser resolves the issue immediately, and the app works as expected.
Hypothesis
I suspect that the issue might be related to the admin token being expired or invalid at the time the authenticate.admin function is called. This could explain why refreshing the browser resolves the problem, as it likely triggers a new session or re-validation process.
How can this issue be resolved, or are there any directions I can explore to address it?