What's your biggest current challenge? Have your say in Community Polls along the right column.

Once shopify app is in production and How to test after that in dev environment

Once shopify app is in production and How to test after that in dev environment

Mohit_garg
Shopify Partner
15 0 1

I have deployed my shopify app on heroku and updated app url and redirection url in partners dashboard now after testing I found some bugs on it so now I have to change app url and redirection to my local host (ngrok) again to fix these bugs and then for testing I have to change it to heroku. Is there any way I can do both without changing urls because It is hard to change url's again and again for testing and bug fixing. 

Replies 8 (8)
Mohit_garg
Shopify Partner
15 0 1

tobebuilds
Shopify Partner
483 34 129

The easiest option is to create 2 separate apps: one for production, one for development. You need to make sure to turn off the option for automatically overwriting the app's redirect URL's in the Shopify CLI, whenever you're working on the production app. Use the command `npm run dev -- --reset` to change the settings.

Founder, Regios Discounts app (4.9 stars, 72 reviews, Built for Shopify)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer
catrawalkar
Shopify Partner
19 0 4

Hi, I am facing similar issue.

 

I understood what you said here, but what about `shopify.app.toml`? This file is linked to dev app. If I push my git repo to prod, how to change/disregard the `shopify.app.toml` file?

catrawalkar@gmail.com

krish115
Shopify Partner
26 0 5

Hii @Mohit_garg , can you help me in, how to deploy the app and also how to generate the build for the created shopify app. Its on cloudflare still.

Mohit_garg
Shopify Partner
15 0 1

tewe
Shopify Partner
244 46 102

Hi @Mohit_garg ,

 

what I do is to have a second app registered in the partners dashboard: a duplication of the production app. Any new releases just pushes the second app to production whenever a bug is fixed. So I do not have to change any urls. Hope this helps.

 

Regards

Thomas

• Was my reply helpful? Click Like to let me know!
• Was your question answered? Mark it as an Accepted Solution
• Check out our Price Updater App

SteveMonsen
Shopify Partner
10 0 5

Set up two apps then use the --config flag to run dev and deploy for specific targets with toml config files:

1. Create app with CLI

1b. Update shopify.app.toml with publicly accessible production URLS and set 

automatically_update_urls_on_dev = false

2. Deploy: npm run deploy

3. Update URLs, if not done so already

4. Create new toml config for development: npm run shopify app dev -- --reset 
4b. Choose "Create new app" and name it the same as the production app but with " Dev" on the end.

5. Migrate scopes to new toml config from shopify.app.toml as they will be blank in the new config (e.g. shopify.app.myappname-dev.toml)
6. Run Development: npm run dev -- --config shopify.app.myappname-dev.toml
7. Run Deploy: npm run deploy -- --config shopify.app.toml (or whatever your production config is... it doesn't need to be "shopify.app.toml")


You could also add these to your npm scripts like:

 

 

"scripts": {
    "dev": "shopify app dev --shopify.my-dev-app.toml",
    "deploy": "shopify app deploy --shopify.my-prod-app.toml",
}

 

 


Reference: https://shopify.dev/docs/apps/tools/cli/configuration

Hope that helps.

If you're not confused, you're not thinking.
SteveMonsen
Shopify Partner
10 0 5

Forgot to add npm run shopify app config link to link your shopify.app.toml to your production app. Then there is no need to add a specific --config flag to deploy. It's default. More here: https://shopify.dev/docs/apps/tools/cli/managing-app-configuration-files#test-your-app-functionality

If you're not confused, you're not thinking.