This looks like a problem outside of k6 - either wrongly configured influxdb or some proxy/network problem. Can you try to write data with curl from the same machine k6 is running from (also from inside docker if you are using docker to run k6)?
If it works then it’s a k6 issue. But there looks to be logic for parsing the username and password from the url and it looks fine … You can also try using K6_INFLUXDB_USERNAME and K6_INFLUXDB_PASSWORD environmental variable to set the username and password, to see if this will at least help.