addons icon indicating copy to clipboard operation
addons copied to clipboard

Inconsistent file names at build time and run time caused by the API_HOST env variable

Open bqbn opened this issue 1 year ago • 2 comments

Describe the problem and steps to reproduce it:

Passing different values of API_HOST to yarn build will cause it to produce different file names.

What happened?

Currently in AWS, the docker run command is the same for starting the app container and building the assets, i.e. the command is yarn build && API_HOST=<host url> yarn start. Basically, yarn build runs with the default API_HOST value.

In GKE, when we start an app pod, the API_HOST is set to a value that points to the internal-api service, thus yarn build runs with a non-default value. The asset build step though, does not run in GKE, so it still uses the default API_HOST value. As a result, the generated file names are different in the app pod and in the asset build step, which causes 404s in the front loading page.

What did you expect to happen?

The file names generated by the asset build step does not depend on the value of the API_HOST env variable.

Or, we should build assets ahead of time so that we don't need to build them again when we start the container (this is tracked in https://github.com/mozilla/addons/issues/2184).

Anything else we should know?

n/a

┆Issue is synchronized with this Jira Task

bqbn avatar Jun 17 '23 21:06 bqbn

(Note: we're currently working around this - see https://github.com/mozilla-it/webservices-infra/commit/d69d77913a963694c665dd88655184bf7d3ad6ab)

diox avatar Sep 18 '23 13:09 diox

Old Jira Ticket: https://mozilla-hub.atlassian.net/browse/ADDFRNT-225

KevinMind avatar May 03 '24 18:05 KevinMind