Backend URL in POS UI Extensions

Shopify Partner
8 0 1

Hello everyone!


I'm developing a POS UI Extension that communicates with my Backend server. The only documentation about using a Backend in POS UI extension I found here.


During development mode, `shopify app dev` using Cloudflare creates my app URL dynamically. Thus each time the Backend URL is different.


How can I access in my POS UI Extension the dynamic URL? Normally I would read `process.env.HOST` (which is set during dev mode), but `process.env` is not available inside POS UI extension.


Screenshot 2023-09-02 at 13.17.31.png



Replies 2 (2)

Shopify Partner
8 0 5



I'm facing same issue. By now, I created a pseudo env file in extensions root in which I define the host url. The file is included in .gitignore so there is no risk to upload it by accident.


Within the pseudoenv file, a constant is exported with the url as a string. This constant is imported in the extensions where the fetch url composition is done.


I know this is far from being the ideal solution, but this way I just have to update the host one time to keep all my extensions connected to the backend. Just have to remember to modify the host to the production one when deploying the extensions.



Hope this help until we got a final solution from Shopify.

Shopify Partner
8 0 1

Thanks @dsn ! That's my current approach too. I also dynamically update the pseudo config file with the changing app URL during dev mode.

Seems like that's the workaround until we got a solution from Shopify.