Docker Hub automated build failing on next.config.js

So basically, I’ve been trying for days to set up automatic building from a staging branch on my git repo, but everytime no matter what I put in Automated Builds ENV keys/values.

Here is a screenshot of my error:

Here’s a screenshot of my next.config.js:


In Automated Builds settings for that ENV key, I got it like this:

Key: NEXT_PUBLIC_S3_DOMAIN Value: example-staging.s3.eu-west-3.amazonaws.com

Tried bunch of stuff, from adding the “” to the value, also tried adding and [“”] but it fails on the build with the same error every time.

Not that this, when built locally and then pushed on Docker Hub, it works perfectly fine once I pull the latest image on my EC2 machine.

Seems I’ve made some progress, now I realize not a single ENV value/key is read once my app is up… Did I miss something? Why are the ENV values not recognized?