Variabel won’t keep values using Heroku

A very small example

let value = null;
const getValues = () => {
  fetch('/third-party-api')
    .then(res => res.json())
    .then(data => {
      value = data;
    })
}

getValues();

app.get("/values", async (req, res) => {
  res.json(value);
});

When it is getting deployed, it will work.
But after x-amount of time, the value will get back to being null.
I am paying for Heroku, so the server will never sleep, and this is why it doesn’t make sense to me why this happens.

Can I somehow prevent this, so the value won’t get back to being null?