Re: Unable to deploy and host a Remix App

Solved

Why am I unable to deploy and host a Remix App?

erik_lindberg_s
Shopify Partner
19 3 6

I have followed the "deploy your app" docu. https://shopify.dev/docs/apps/deployment/web after creating a blank remix app. I'm unable to deploy the app to fly, heroku and DigitalOcean. All returns same error.

 

-04-16 11:58:47] > start
[2024-04-16 11:58:47] > remix-serve ./build/server/index.js
[2024-04-16 11:58:47]
[2024-04-16 11:58:51]
[2024-04-16 11:58:51] /app/node_modules/@shopify/shopify-app-remix/build/cjs/server/shopify-app.js:98
[2024-04-16 11:58:51] throw new shopifyApi.ShopifyError('Invalid appUrl provided. Please provide a valid URL.');
[2024-04-16 11:58:51] ^
[2024-04-16 11:58:51] Error: Invalid appUrl provided. Please provide a valid URL.
[2024-04-16 11:58:51] at deriveApi (/app/node_modules/@shopify/shopify-app-remix/build/cjs/server/shopify-app.js:98:11)
[2024-04-16 11:58:51] at shopifyApp (/app/node_modules/@shopify/shopify-app-remix/build/cjs/server/shopify-app.js:49:15)
[2024-04-16 11:58:51] at file:///app/build/server/index.js?t=1713268522877.906:22:19
[2024-04-16 11:58:51] at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
[2024-04-16 11:58:51] at ModuleLoader.import (node:internal/modules/esm/loader:337:24)
[2024-04-16 11:58:51] at importModuleDynamicallyWrapper (node:internal/vm/module:432:15)
[2024-04-16 11:58:51] at run (/app/node_modules/@remix-run/serve/dist/cli.js:1

My .env file is empty and I have set the environment variables directly on every platform. 

Anyone knows whats going on here?

Accepted Solution (1)

foladun
Shopify Partner
1 1 3

This is an accepted solution.

Hi @erik_lindberg_s ,
I just fixed the same issue while deploying my app on DigitalOcean. The problem was using the wrong variable for the app's web address.
In my case the error was caused by the fact that I was using the HOST variable to set the app's url instead of SHOPIFY_APP_URL.

To solve it, I started my local environment and used the app's generated web address as the correct variable value for SHOPIFY_APP_URL and deleted the HOST variable.
I'm not sure if starting the local environment was necessary, but I used the actual web address instead of a placeholder like https://www.google.com. 
You may find that using the placeholder works anyway when using the correct variable.

A hint in the documentation led me to this solution:

foladun_0-1713280008271.png

It says:
"SHOPIFY_APP_URL (or HOST for non-Remix apps)"

Since my app is built with Remix, this advice might work for you if you've followed the Shopify Documentation and built with Remix.

Hope this helps you 👍🏿


View solution in original post

Replies 3 (3)

foladun
Shopify Partner
1 1 3

This is an accepted solution.

Hi @erik_lindberg_s ,
I just fixed the same issue while deploying my app on DigitalOcean. The problem was using the wrong variable for the app's web address.
In my case the error was caused by the fact that I was using the HOST variable to set the app's url instead of SHOPIFY_APP_URL.

To solve it, I started my local environment and used the app's generated web address as the correct variable value for SHOPIFY_APP_URL and deleted the HOST variable.
I'm not sure if starting the local environment was necessary, but I used the actual web address instead of a placeholder like https://www.google.com. 
You may find that using the placeholder works anyway when using the correct variable.

A hint in the documentation led me to this solution:

foladun_0-1713280008271.png

It says:
"SHOPIFY_APP_URL (or HOST for non-Remix apps)"

Since my app is built with Remix, this advice might work for you if you've followed the Shopify Documentation and built with Remix.

Hope this helps you 👍🏿


erik_lindberg_s
Shopify Partner
19 3 6

Thx for taking the time to answer. 

 

My initial thought was that I already tried that and that I had set the variable to SHOPIFY_APP_URL and not HOST when working in the local environment. But you were right. Setting the variable name to SHOPIFY_APP_URL and not HOST fixed it. At least on DibtialOcean.

Thx

EssDeeJay
Shopify Partner
6 0 2

Correct. This works for DigitalOcean Deployment. Mine worked even with placeholders such as https://www.google.com, so starting local server was not necessary I believe. 

Founder | Lead Developer @The SJ Development
Contact Us
Website | Email