-
Notifications
You must be signed in to change notification settings - Fork 653
PUBLIC_URL env not updated from staging to production #161
Comments
See Runtime config variables, a feature created specifically for this buildpack that eliminates the re-build step by injecting variables into the Javascript bundle as each Heroku dyno starts-up. |
Thank you for your answer! In fact, I'm already using runtime config variables in my app and it works like a charm, but PUBLIC_URL is used in webpack.config.prod.js file (I ejected), and I'm not sure I can use it inside this file (I tried but it didn't works...) |
I see what you mean @marinav. Unfortunately I do not know much about how I imagine working around this by writing a |
I had this same issue, trying to promote a cloudfront URL through heroku pipelines. I ended up doing something very similar to what @mars described. Usage:
if [ -f "build/index.html" ]; then
sed -iE "s,{{DYNAMIC_PUBLIC_URL}},$DYNAMIC_PUBLIC_URL,g" build/index.html
fi You might also like to add an TEMPLATE_STR='{{DYNAMIC_PUBLIC_URL}}'
if [ -f "build/index.html" ]; then
echo "Injecting 'DYNAMIC_PUBLIC_URL' value '$DYNAMIC_PUBLIC_URL' into build/index.html by replacing the text '$TEMPLATE_STR' (from .profile.d/inject_dynamic_public_url.sh)"
sed -iE "s,$TEMPLATE_STR,$DYNAMIC_PUBLIC_URL,g" build/index.html
fi Logs:
|
I was previously using v1.2.1 of this buildpack and just upgraded and encoutered this issue. Weirdly, it looks like the PUBLIC_URL is both set and not set depending on what url I visit the app from. In other words, if I have PUBLIC_URL set to |
Hello,
Thank you for your work ! I'm using your buildpack and it works very well but I have a question.
I am trying to serve my assets from a CDN, so I created two CDN, one for my staging app an another one for my production app. I put the CDN's url in the
PUBLIC_URL
env var and it works fine in staging. IndeedPUBLIC_URL
is set at build time. Unfortunately, when my app is “promoted” to production (I am using heroku's pipeline)PUBLIC_URL
keeps staging's url.I tried to rename the env var to
REACT_APP_PUBLIC_URL
but it doesn't work better.Do you have an idea to make it works without rebuild the app for production ?
Thank you !
The text was updated successfully, but these errors were encountered: