Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Shopify/CLI doesn't update config con deploy and doesn't apply automatically_update_urls_on_dev anymore #3860

Closed
2 tasks done
mscapoli opened this issue May 7, 2024 · 8 comments
Labels
Area: @shopify/app @shopify/app package issues Type: Bug Something isn't working

Comments

@mscapoli
Copy link

mscapoli commented May 7, 2024

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

App

Expected behavior

As for @shopify/cli version v3.55.4 command

shopify app deploy --config <my-toml>.toml

should deploy the current target config file and

shopify app dev

should rotate cloudflare urls.

Actual behavior

The current cloudflare target url configured on remote Partnership Dashboard returns ... server IP address could not be found.
It doesn't rotate at shopify app dev
The remote Partnership Dashboard config cannot be modified by deploying a new app version.

Screenshot 2024-05-07 alle 10 47 07

Verbose output

m.scapoli@MacBook-Pro-di-mscapoli company-returns-app % npm run shopify:deploy:dev -- -f

> shopify:deploy:dev
> shopify app deploy --config shopify.app.dev.toml -f

╭─ info ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                              │
│  Using .env.dev:                                                                                             │
│                                                                                                              │
│    • Org:             MyCompany Spa                                                                          │
│    • App:             company Resi DEV                                                                    │
│    • Include config:  Yes                                                                                    │
│                                                                                                              │
│   You can pass `--reset` to your command to reset your app configuration.                                    │
│                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯


Releasing a new app version as part of company Resi DEV


╭─ success ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                              │
│  New version released to users.                                                                              │
│                                                                                                              │
│  company-resi-dev-25                                                                                      │
│                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

m.scapoli@MacBook-Pro-di-mscapoli company-returns-app % npm run dev

> predev
> prisma generate && prisma migrate deploy

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.10.2) to ./node_modules/@prisma/client in 174ms

Start using Prisma Client in Node.js (See: https://pris.ly/d/client)

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)

import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()

See other ways of importing Prisma Client: http://pris.ly/d/importing-client

┌─────────────────────────────────────────────────────────────┐
│  Deploying your app to serverless or edge functions?        │
│  Try Prisma Accelerate for connection pooling and caching.  │
│  https://pris.ly/cli/accelerate                             │
└─────────────────────────────────────────────────────────────┘

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "dev.sqlite" at "file:dev.sqlite"

1 migration found in prisma/migrations


No pending migrations to apply.

> dev
> npm run config:use:dev && npm run info && shopify app dev


> config:use:dev
> shopify app config use shopify.app.dev.toml

╭─ success ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                              │
│  Using configuration file shopify.app.dev.toml                                                               │
│                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯


> info
> shopify app info

CURRENT APP CONFIGURATION
Configuration file   shopify.app.dev.toml
App name             company Resi DEV
Client ID            xxxxxxxxx
Access scopes        customer_read_orders,read_customers,read_orders,read_returns,write_orders,write_returns
Dev store            local-dev-company.myshopify.com
Update URLs          Yes
Partners account     myemail@mycompany.com

💡 To change these, run `npm run dev -- --reset`

YOUR PROJECT
Root location   /Users/m.scapoli/workspace/company/company-returns-app

DIRECTORY COMPONENTS
web
📂 web

TOOLING AND SYSTEM
Shopify CLI       3.60.0
Package manager   npm
OS                darwin-amd64
Shell             /bin/zsh
Node version      v20.11.0
╭─ info ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                              │
│  Using shopify.app.dev.toml:                                                                                 │
│                                                                                                              │
│    • Org:             MyCompany Spa                                                                          │
│    • App:             company Resi DEV                                                                    │
│    • Dev store:       local-dev-company.myshopify.com                                                     │
│    • Update URLs:     Yes                                                                                    │
│                                                                                                              │
│   You can pass `--reset` to your command to reset your app configuration.                                    │
│                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

10:22:53 │ graphiql   │ GraphiQL server started on port 3457

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

› Press d │ toggle development store preview: ✔ on
› Press g │ open GraphiQL (Admin API) in your browser
› Press p │ preview in your browser
› Press q │ quit

Preview URL: https://local-dev-company.myshopify.com/admin/oauth/redirect_from_cli?client_id=xxxxxxx
GraphiQL URL: http://localhost:3457/graphiql

Reproduction steps

  1. tried to re-link correct config with shopify app config use --reset and then shopify app config link
    Output:
> config:link
> shopify app config link


Before proceeding, your project needs to be associated with an app.

?  Create this project as a new app on Shopify?
✔  No, connect it to an existing app

?  Which existing app is this for?
✔  company Resi DEV (shopify.app.dev.toml)

╭─ success ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                              │
│  shopify.app.dev.toml is now linked to "company Resi DEV" on Shopify                                         │
│                                                                                                              │
│  Using shopify.app.dev.toml as your default config.                                                          │
│                                                                                                              │
│  Next steps                                                                                                  │
│    • Make updates to shopify.app.dev.toml in your local project                                              │
│    • To upload your config, run `npm run shopify app deploy`                                                 │
│                                                                                                              │
│  Reference                                                                                                   │
│    • App configuration                                                                                       │
│                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  1. the previous command pulls a configuration that is missing entries like automatically_update_urls_on_dev = true and include_config_on_deploy = true and sets embedded = true modifying my current configuration (as expected as mentioned in the doc https://shopify.dev/docs/api/shopify-cli/app/app-config-link)
  2. I revert the changes made by the pull, restoring the previous configuration and try to execute a deploy forcing the configuration push shopify app deploy --config shopify.app.dev.toml -f with my custom config file as target
  3. Then I run in sequence with a single command
shopify app config use shopify.app.dev.toml
shopify app info
shopify app dev
  1. the result is a dev app with broken and unchangeable cloudflare url

Operating System

Mac OS Sonoma 14.2.1

Shopify CLI version (check your project's package.json if you're not sure)

tried 3.59.3 and 3.60.0

Shell

zsh

Node version (run node -v if you're not sure)

v20.11.0

What language and version are you using in your application?

Typescript v5.2.2

@mscapoli mscapoli added the Type: Bug Something isn't working label May 7, 2024
@gonzaloriestra
Copy link
Contributor

Hi! Thanks for reporting the issue. Could you please upgrade the CLI to v3.60.0 and share the output of these commands?

shopify app config use shopify.app.dev.toml
cat shopify.app.dev.toml
shopify app dev --verbose

@mscapoli
Copy link
Author

mscapoli commented May 7, 2024

@gonzaloriestra please make sure that the effort I made to fill out your form is worth something, I already wrote that everything was tested with CLI 3.60.0...

  1. The first command output is already present in a detailed form in the Verbose output field, however I paste it again:
> shopify app config use shopify.app.dev.toml

╭─ success ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                              │
│  Using configuration file shopify.app.dev.toml                                                               │
│                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯


> info
> shopify app info

CURRENT APP CONFIGURATION
Configuration file   shopify.app.dev.toml
App name             company Resi DEV
Client ID            xxxxxxx
Access scopes        customer_read_orders,read_customers,read_orders,read_returns,write_orders,write_returns
Dev store            local-dev-company.myshopify.com
Update URLs          Yes
Partners account     myemail@mycompany.com

💡 To change these, run `npm run dev -- --reset`

YOUR PROJECT
Root location   /Users/m.scapoli/workspace/company/company-returns-app

DIRECTORY COMPONENTS
web
📂 web

TOOLING AND SYSTEM
Shopify CLI       3.60.0
Package manager   npm
OS                darwin-amd64
Shell             /bin/zsh
Node version      v20.11.0
  1. The shopify.app.dev.toml content (sensible info will be changed)
# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration

client_id = "xxxxxx"
name = "Company Resi DEV"
handle = "company-returns-app-dev"
application_url = "https://size-conspiracy-doing-therapist.trycloudflare.com/"
embedded = true

[build]
automatically_update_urls_on_dev = true
dev_store_url = "local-dev-company.myshopify.com"
include_config_on_deploy = true

[access_scopes]
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
scopes = "customer_read_orders,read_customers,read_orders,read_returns,write_orders,write_returns"

[auth]
redirect_urls = [
  "https://size-conspiracy-doing-therapist.trycloudflare.com/auth/callback",
  "https://size-conspiracy-doing-therapist.trycloudflare.com/auth/shopify/callback",
  "https://size-conspiracy-doing-therapist.trycloudflare.com/api/auth/callback"
]

[webhooks]
api_version = "2024-01"

[pos]
embedded = false
  1. Output of shopify app dev --verbose:
npm verb cli /Users/m.scapoli/.nvm/versions/node/v20.11.0/bin/node /Users/m.scapoli/.nvm/versions/node/v20.11.0/bin/npm
npm info using npm@10.2.4
npm info using node@v20.11.0
npm verb title npm run shopify app dev
npm verb argv "run" "shopify" "app" "dev" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/Users/m.scapoli/.npm/_logs/2024-05-07T13_28_55_476Z-
npm verb logfile /Users/m.scapoli/.npm/_logs/2024-05-07T13_28_55_476Z-debug-0.log

> shopify
> shopify app dev

╭─ info ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                              │
│  Using shopify.app.dev.toml:                                                                                 │
│                                                                                                              │
│    • Org:             MyCompany Spa                                                                          │
│    • App:             company Resi DEV                                                                    │
│    • Dev store:       local-dev-company.myshopify.com                                                     │
│    • Update URLs:     Yes                                                                                    │
│                                                                                                              │
│   You can pass `--reset` to your command to reset your app configuration.                                    │
│                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

15:29:04 │ graphiql   │ GraphiQL server started on port 3457

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

› Press d │ toggle development store preview: ✔ on
› Press g │ open GraphiQL (Admin API) in your browser
› Press p │ preview in your browser
› Press q │ quit

Preview URL: https://local-dev-company.myshopify.com/admin/oauth/redirect_from_cli?client_id=xxxxx
GraphiQL URL: http://localhost:3457/graphiql

@gonzaloriestra
Copy link
Contributor

Don't worry, I had read it carefully, I just wanted to ensure you were using v3.60 with the right TOML this time.

It seems that the --verbose flag is being used by NPM instead of Shopify CLI. Could you run the last command again this way? shopify app dev -- --verbose

@mscapoli
Copy link
Author

mscapoli commented May 7, 2024

My bad this time, sorry.
Here the correct output of shopify app dev -- --verbose

shopify_app_dev_verbose.txt

@gonzaloriestra
Copy link
Contributor

Hmm, looking at the log, it's indeed skipping the URL update for some reason... Could you run this command to see if there is any CLI flag in your environment?

printenv | grep SHOPIFY

One more test: could you create a new app to check if it also happens?

shopify app init
shopify app dev

And then choose yes to update URLs and check in Partners if the Cloudflare URL is there.

@mscapoli
Copy link
Author

mscapoli commented May 9, 2024

@gonzaloriestra printenv | grep SHOPIFY did not return anything. Count that i run shopifycommand as a per project dependency, not installed globally

For the second test I runned:

npm init @shopify/app@latest

and then

npm run dev

and the app was deployed without a problem with

URL app: 
https://oasis-wordpress-til-condo.trycloudflare.com/
Redirect URLs:
https://oasis-wordpress-til-condo.trycloudflare.com/auth/callback
https://oasis-wordpress-til-condo.trycloudflare.com/auth/shopify/callback
https://oasis-wordpress-til-condo.trycloudflare.com/api/auth/callback

@gonzaloriestra is it possible to reset my current app with not working deploy? also creating from the same folder/project a new app with a different handle and new client_id stuck on the page saying the app is installed on the store but won't show any app in the store itself

@gonzaloriestra
Copy link
Contributor

I'm still not sure what could be happening... Could you help me to debug it?

  • Edit the file node_modules/@shopify/cli/dist/index.js from your project folder, look for frontendConfig || backendConfig and add this lines before
  console.log(`frontendConfig: ${frontendConfig}`);
  console.log(`backendConfig: ${backendConfig}`);
  console.log(`commandSpecifiedToUpdate: ${commandSpecifiedToUpdate}`);
  • A few lines below, before if (shouldUpdateURLs), add this
console.log(`shouldUpdateURLs: ${shouldUpdateURLs}`);
  • Run npm run dev again and share the output

@isaacroldan isaacroldan added the Area: @shopify/app @shopify/app package issues label May 10, 2024
@mscapoli
Copy link
Author

Hi @gonzaloriestra, hi all, after your last comment with the above requests something rised in my mind: due to a succession of deploy in various environments (test, prod) at some point an error began to appear telling me something similar to "can only be one config file for the backend side" (can't find the exact text line in the shell output right now and I'm not able to reproduce 'til next deploy), ended up I had commented the shopify.web.toml and the error message on the deploy had gone.
Now I have restored the shopify.web.toml the DEV flow of the Shopify App returned to work.

Thanks to you @gonzaloriestra for your help and to light up in my mind these temporary change that I made.
I think we can mark this as Resolved.

Now remains by my side to understand better the true meaning of shopify.web.toml that I was thinking was only a config file meaningful for the bootstrap of the first deploy and nothing else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: @shopify/app @shopify/app package issues Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants