Skip to content

[Feature] Allow Flow action extension runtime_urls to be relative#7715

Merged
EliasJRH merged 12 commits into
mainfrom
relative_dev_flow_action_urls
Jun 15, 2026
Merged

[Feature] Allow Flow action extension runtime_urls to be relative#7715
EliasJRH merged 12 commits into
mainfrom
relative_dev_flow_action_urls

Conversation

@EliasJRH

@EliasJRH EliasJRH commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Closes https://github.com/Shopify/flow/issues/21604

To start allowing the usage of URLs relative to an apps application_url in Flow action extensions.

WHAT is this pull request doing?

This pull request extends the capabilities of Flow action extensions to allow them to start using relative runtime_urls in their config.

How to test your changes?

  • Create an with a Flow action extension with a relative runtime_url
  • Run shopify app dev, install app + Flow on dev store and create workflow using Flow action extension
  • Trigger workflow, observe that local tunnel endpoint is hit at specified relative path
  • Deploy app with shopify app deploy, create workflow with deployed Flow action extension
  • Trigger workflow, observe that application url endpoint is hit at specified relative path

Post-release steps

The existing dev docs for Flow action extensions make no mention of using relative urls or how it would work with a local app dev setup. Documentation will be written to describe this.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jun 4, 2026
@EliasJRH EliasJRH changed the title Relative dev flow action urls [Feature] Allow Flow action extension runtime_urls to be relative Jun 4, 2026
@EliasJRH EliasJRH self-assigned this Jun 4, 2026
@EliasJRH EliasJRH added the includes-post-release-steps PRs including this label require additional steps after releasing label Jun 4, 2026
@github-actions github-actions Bot added Area: @shopify/app @shopify/app package issues and removed no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. labels Jun 4, 2026
@EliasJRH
EliasJRH marked this pull request as ready for review June 4, 2026 20:09
@EliasJRH
EliasJRH requested review from a team as code owners June 4, 2026 20:09
@EliasJRH
EliasJRH requested a review from ryanische June 4, 2026 20:14
return baseFieldSchema.parse(configField)
}

export const startsWithHttps = (url: string) => url.startsWith('https://')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still have a validation where if the the url is not relative, we check that it starts with https?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the validateFlowActionUrl calls validateRelativeUrl which will return true if the url is relative or https

Comment on lines +59 to +63
const containsUrlControlCharacter = (value: string) => /[\r\n\t]/.test(value)

const isFlowActionRelativeUrl = (value: string) => {
return value.startsWith('/') && !value.startsWith('//') && !containsUrlControlCharacter(value)
}

@ryanische ryanische Jun 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these relevant to the validateRelativeUrl function in validation/common.ts as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They could be. I'm not sure what other cases the validateRelativeUrl handles so I think it'd be best to propose as a follow up for the CLI team.

Comment thread packages/app/src/cli/services/flow/validation.ts Outdated
appModuleFeatures: (_) => [],
deployConfig: async (config, extensionPath) => {
/**
* During `app dev`, swap any relative URLs (starting with `/`) for the dev

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming behaviour - this only happens for app dev, not app deploy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, during app dev relative urls will be prepended by the auto-generated cloudflare tunnel url and during app deploy they'll be prepended with the configured application url

)
}

if (!resolvedUrl.startsWith('https://')) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a URL validation function in packages/app/src/cli/models/app/validation/common.ts you could re-use

It also checks for newlines, so maybe you can drop that check from the relative URL validation as well.

Feel free to update it if needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be a good addition outside of this PR as I'd want to make sure that the other extensions that use this validation would still work as expected.

Base automatically changed from extend_deploy_config to main June 11, 2026 13:18
Copilot AI review requested due to automatic review settings June 11, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Flow action extension URL handling to allow runtime_url (and related URL fields) to be specified as relative paths (e.g. /api/execute) and then resolved against the app’s application_url during app dev and app deploy.

Changes:

  • Replaced Flow action URL validation to accept either absolute HTTPS URLs or relative URLs starting with a single /, with additional control-character and protocol-relative URL rejection.
  • Added URL resolution logic to prepend the app/tunnel application_url for relative Flow action URLs during dev and deploy.
  • Added/expanded unit tests and introduced a changeset for a minor bump.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/app/src/cli/services/flow/validation.ts Adds validateFlowActionUrl to validate absolute HTTPS or /... relative URLs and reject control characters / protocol-relative URLs.
packages/app/src/cli/services/flow/validation.test.ts Adds test coverage for validateFlowActionUrl acceptance/rejection cases.
packages/app/src/cli/services/flow/utils.ts Introduces resolveFlowActionUrl to resolve relative URLs against application_url and enforce HTTPS.
packages/app/src/cli/services/flow/utils.test.ts Adds tests covering URL resolution and error cases for resolveFlowActionUrl.
packages/app/src/cli/services/flow/types.ts Defines the set of Flow action URL fields and the FlowActionUrlField union type.
packages/app/src/cli/models/extensions/specifications/flow_action.ts Uses the new validator and resolves URL fields for deploy/dev patching.
packages/app/src/cli/models/extensions/specifications/flow_action.test.ts Adds spec-level tests for parsing, deploy URL resolution, and dev URL patching.
.changeset/light-lamps-draw.md Declares a minor bump for @shopify/app due to new relative URL support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/app/src/cli/services/flow/utils.ts Outdated
@EliasJRH
EliasJRH requested a review from ryanische June 15, 2026 13:43
@EliasJRH
EliasJRH added this pull request to the merge queue Jun 15, 2026
Merged via the queue into main with commit b55ce16 Jun 15, 2026
28 checks passed
@EliasJRH
EliasJRH deleted the relative_dev_flow_action_urls branch June 15, 2026 17:51
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 includes-post-release-steps PRs including this label require additional steps after releasing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants