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 Fix] process.env.APP_URL doesn't work in production build #5258

Conversation

t-jindai
Copy link

@t-jindai t-jindai commented Jan 23, 2025

WHY are these changes introduced?

UI Extensions can request web API that you defined in web app.

In local development by using shopify app dev, web API host changes every time you launch dev server via cloudflare tunnel. It is very useful to use APP_URL environment variable to refer that tunnel url like this.

UI Extension

const url = `${process.env.APP_URL}/api/awesome-logic`

In production, however, APP_URL cannot be web API url (application_url in shopify.app.toml) through shopify app deploy or shopify app build. We expect that environment variables will change its value the environment basis (local, production) but it don't work now.

WHAT is this pull request doing?

shopify app dev passes configuration.application_url as APP_URL to extension build process.

otherwise, it isn't passed to extension build process in shopify app build and shopify app deploy command.

{stderr, stdout, signal, app: options.app, environment: 'production'},

In this PR, I added extra argument as AppURL.

How to test your changes?

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@t-jindai t-jindai force-pushed the add-application-url-to-environment-variables-in-extension-build branch from 71f69f9 to 346929c Compare January 24, 2025 01:42
to be able to use through `APP_URL` environment variable.
@t-jindai t-jindai force-pushed the add-application-url-to-environment-variables-in-extension-build branch from 346929c to fab6d2c Compare January 24, 2025 02:11
@t-jindai t-jindai changed the title Added application_url to extension build [Bug Fix] Added application_url to extensions build environment variables Jan 24, 2025
@t-jindai t-jindai marked this pull request as ready for review January 24, 2025 02:54
@t-jindai t-jindai requested a review from a team as a code owner January 24, 2025 02:54
@t-jindai t-jindai changed the title [Bug Fix] Added application_url to extensions build environment variables [Bug Fix] process.env.APP_URL doesn't work in production build Jan 25, 2025
@t-jindai t-jindai closed this Jan 26, 2025
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