Reading environment file from s3 in serverless.yml fails

I’m trying to load the environment directly from a s3 bucket but I’m getting “Invalid characters in environment variable 0”
Here is the relevant section of the serverless.yml

provider:
  name: aws
  environment:
    ${s3:####/serverless/#####/production/.env.production.json}

Running with the same file locally works
${file(.env.production.json)}

Any idea?