Environmental variable read issue in Heroku deployed app

I got a React/Node.js app which is deployed to Herouku.

I have an env variable named REACT_APP_BASE_URL which value is http://localhost:4000 locally and the production site’s URL in Heroku’s config vars.

The issue appears when i’m trying to send an SMS with a string containing the URL, like so:

const msg = `Hello! view your profile in ${process.env.REACT_APP_BASE_URL}/user/${id}` 

Locally it works fine and but in production the result is:

Hello! view your profile in /user/${id}

I would guess it can’t read the value from Heroku’s config vars, but this isn’t the case as this base url reference is working fine in other places in the same component (XHR requests where I paste it the same way and are happening just before the problematic call).

Any idea?