Heroku Deployment Issue (Environment / Code Promotion)

System Information

Hello!

disclaimer: This seems more like a Heroku restriction/issue then Strapi itself, but I’m curious if anyone else has encountered this.

I’m running into an issue with my Heroku deployment, more specifically the “promote” portion. My pipeline on Heroku consists of two environments (staging, production). When I push code out my staging environment automatically deploys the code. Everything is working great in the staging environment… no issues. However, when I “promote” this to my production environment I start to see an issue with the admin pages specifically.

From what I’m seeing it’s actually making calls to the staging environment when promoted to production (and it’s using the staging database in admin area, so not ideal lol - I’ve double checked my production environment settings 20x+ times). Is this due to how Heroku works since my initial deployment to the staging environment runs npm run build, but then the promotion doesn’t actually run the build? Is it due to the strapi ./cache/ (assuming Heroku copies it up in some way with the “promote” - please correct if wrong)?

However, my SSR application correctly hits www.production.xxx/graphql and grabs production data (not staging data), which is obviously great. Seems like it’s just some ordeal with the admin pages… maybe I’m doing something wrong?

Anyways, I did some additional debugging on my end and indeed when I changed the staging environment variables (HEROKU_URL… etc. URLs) then made a new commit and pushed up to production it worked okay for production (course staging would be broke). When requesting www.production.xxx/admin it properly made calls to the same environment www.production.xxx/admin/project-type… so on. This is by no means a solution (would make absolutely no sense to replace variables every deployment), but I think it confirms it’s due to the build (npm run build) not being run during “promote?” Are there workarounds or am I maybe just missing something?

Example Of My Issue:

Request URL: www.production.xxx/admin
200 OK

…loads other .js resources (from www.production.xxx) and then makes requests to the staging environment like below…

Request URL: www.staging.xxx/admin/project-type
200 OK

Request URL: www.staging.xxx/admin/renew-token
200 OK

Request URL: www.staging.xxx/admin/init
200 OK

…so on so forth (information, user permission, me, locales, components, content-types)

Environment Variables & Pipeline Image:

I could only upload one image unfortunately :frowning:

Strapi Configuration File Code:

/config/env/staging/server.js & /config/env/production/server.js

module.exports = ({ env }) => ({
  url: env('HEROKU_URL'),
  app: {
    keys: env.array('APP_KEYS'),
  },
});

/config/admin.js

module.exports = ({ env }) => ({
  url: env('HEROKU_ADMIN_URL', '/admin'),
  auth: {
    secret: env('ADMIN_JWT_SECRET'),
  },
  apiToken: {
    salt: env('API_TOKEN_SALT'),
  }
});

Please let me know if there is any other information I can provide or anything you want me to clarify… maybe this is a me only issue lol?

Thanks much!