For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
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.
Thanks!
Hello,
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.
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.