Configure wrangler from build script

I am trying to deploy a static website to Workers Site using Bitbucket Pipelines.
In the yaml (or my cli) I am doing the following to configure wrangler but always fails (I have tested the following
wrangler config <<< '[email protected]\nvalidtoken\n' but I get a Code 6003: Invalid request headers
Same thing if I pipe a text file with the email break line and the api key