Skip to content

Preserve template application_url during app creation#7225

Open
MitchLillie wants to merge 1 commit intomainfrom
cx-preserve-application-url
Open

Preserve template application_url during app creation#7225
MitchLillie wants to merge 1 commit intomainfrom
cx-preserve-application-url

Conversation

@MitchLillie
Copy link
Copy Markdown
Contributor

Summary

  • Threads applicationUrl and redirectUrls from template config through CreateAppOptions to both Partners and App Management platform clients
  • When shopify app init uses an extension-only template, the template's application_url (https://extensions.shopifycdn.com) is now sent to the platform at creation time instead of a hardcoded https://example.com placeholder
  • Falls back to existing defaults when no template URL is present (fully backward compatible)

Fixes shop/issues-admin-extensibility#2395

What was happening

  1. app init clones the extension-only template which has application_url = "https://extensions.shopifycdn.com"
  2. loadConfigForAppCreation() reads the template TOML but discards application_url
  3. createApp() sends hardcoded https://example.com to the platform
  4. link() deep-merges remote config over local — remote wins for scalars, so example.com overwrites the template URL in the local TOML

This also affects --reset: fetchAppRemoteConfiguration() returns undefined for Partners-based apps, so the fallback uses remoteApp.applicationUrl — the creation-time value that deploy never updates. By fixing the creation-time URL, --reset also returns the correct value.

Changes

File Change
developer-platform-client.ts Added applicationUrl and redirectUrls to CreateAppOptions interface
loader.ts loadConfigForAppCreation() now extracts application_url and auth.redirect_urls from template TOML
app.ts creationDefaultOptions() includes applicationUrl and redirectUrls for the link() code path
partners-client.ts getAppVars() uses options.applicationUrl ?? defaultAppUrl with ?? fallback; simplified from branching if/else to single return
app-management-client.ts createAppVars() uses options.applicationUrl ?? defaultAppUrl and options.redirectUrls ?? [defaultRedirectUrl]
loader.test.ts 2 new tests for URL extraction from template config
partners-client.test.ts 1 new test for custom URL passthrough
app-management-client.test.ts 1 new test for custom URL passthrough

Test plan

Automated:

pnpm install
pnpx vitest run packages/app/src/cli/models/app/loader.test.ts
pnpx vitest run packages/app/src/cli/utilities/developer-platform-client/partners-client.test.ts
pnpx vitest run packages/app/src/cli/utilities/developer-platform-client/app-management-client.test.ts

Manual — extension-only template:

# From the CLI repo root, init a new app using the extension-only template
pnpm shopify app init --template https://github.com/nicely-formed/shopify-app-template-extension-only --name test-preserve-url

# Inspect the generated TOML — application_url should be https://extensions.shopifycdn.com
cat ~/Desktop/test-preserve-url/shopify.app.toml

# Verify --reset preserves the URL
cd ~/Desktop/test-preserve-url
pnpm shopify app dev --reset
# Select the same app, check the TOML again — should still show extensions.shopifycdn.com

Manual — standard template (regression check):

# Init with default template to ensure no regression
pnpm shopify app init --name test-standard-app

# application_url should be https://example.com (default for launchable apps)
cat ~/Desktop/test-standard-app/shopify.app.toml

🤖 Generated with Claude Code

When `shopify app init` uses an extension-only template (e.g.
shopify-app-template-extension-only), the template specifies
`application_url = "https://extensions.shopifycdn.com"`. Previously this
URL was discarded — createApp() always sent hardcoded placeholder URLs
to the platform. The subsequent link() step then pulled the placeholder
back from the remote, overwriting the local config.

Thread template URLs through CreateAppOptions so the platform receives
the correct URL at creation time. Falls back to existing defaults when
no template URL is provided (backward compatible).

Fixes shop/issues-admin-extensibility#2395

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MitchLillie MitchLillie requested a review from a team as a code owner April 8, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant