Solved

Remix Admin GraphQL Cannot Authorize After Deployment

angpro
Shopify Partner
10 1 1

Hello,

 

I am developing an app using Remix.

 

The architecture of the app is Frontend -> Proxy Link -> Backend, so the request is coming through the proxy link.

Then the app makes an Admin GraphQL query requesting products:

 

 

export async function action({ request }) {
...
const response = await authenticate.public.appProxy(request);
const responseProductVariants = await response.admin?.graphql(QUERY);
const responseJson = await responseProductVariants?.json();
...
}

 

 


The app is installed on the store and works fine.

 

But after I deploy a new version of the app on the server (I am using Heroku) without updating any settings it breaks auth GraphQL API process and I cannot make the query, just returns "undefined". The proxy link itself works fine and I am able to get the request thought it. The problem is fixed after reinstalling the app on the store.

 

This issue is frustrating because make it impossible to provide the app to several independent stores, because after updating the code and deploying the app - it requires to reinstall the app on every store.

 

I suspect that this issue could be related to:
1) Usage of the proxy link request in auth;

2) Some incorrect config settings;

3) Usage of the custom distribution (with a link). 

 

Here is the config settings:

client_id = ...
name = ...
handle =...
application_url = ...
embedded = true

[build]
automatically_update_urls_on_dev = false
dev_store_url = ...
include_config_on_deploy = true

[access_scopes]
scopes = "write_products,read_publications,read_inventory"

[auth]
redirect_urls = [
  "https://.../auth/callback",
  "https://.../auth/shopify/callback",
  "https://.../api/auth/callback"
]

[webhooks]
api_version = "2024-01"

[app_proxy]
url = "https://.../input"
subpath = "my-input"
prefix = "apps"

[pos]
embedded = false

 

Could the deployment of the app somehow break the proxy link auth? Or is it related to something else? And how to deal with it?

 

I would very appreciate any help in resolving this issue!

 

 

Accepted Solution (1)

angpro
Shopify Partner
10 1 1

This is an accepted solution.

UPD: This issue was my mistake, because I used default DB configuration from Remix template. So the DB is not a separate instance and running on the same VM as the server. That is why DB is cleans up with the deployment.

DB stores session data.

View solution in original post

Replies 2 (2)

angpro
Shopify Partner
10 1 1

I have discovered that this problem is fixed as well if after the deployment I navigate to the admin page of the app in the store. So it somehow reloads the app.

 

But is there a way to make it work sustainable? For example, provide the option to update the app from the shop admin.

angpro
Shopify Partner
10 1 1

This is an accepted solution.

UPD: This issue was my mistake, because I used default DB configuration from Remix template. So the DB is not a separate instance and running on the same VM as the server. That is why DB is cleans up with the deployment.

DB stores session data.