Can you retry with code similar to described here: Using secrets/passwords securely in processes (Using Docker Secrets, not storing passwords in process variables)
If it does not work, then would say your env is not “typical” and something else is going on