Description
Description
If I run any AWS cmdlet from AWS.Tools that communicate with AWS services fail after about 35 seconds with the error message "Request headers must contain only ASCII characters.".
$PSCulture is set to sv-SE in PowerShell.
If I go into macOS system settings and change regional locale settings to country USA instead of Sweden, then run the same thing, it works just fine.
Also, if I start a pwsh terminal session in VS Code, it defaults to en-US for $PSCulture, even if the system locale is set to Sweden (sv-SE). In VS Code terminal it also works fine there.
Presumably since Swedish includes a few non-ASCII characters in the alphabet, this may be part of what is causing the problem here. I noticed that there was a query from 2019 in the AWS community forums for PowerShell scripting where a person had the same issue on macOS (10.15), with no response. So it does not seem to be a new issue.
Reproduction Steps
- In macOS regional settings, change the country to Sweden and change the primary language to Sweden. Accept all changes as-is.
- Start an Apple Terminal with pwsh
- Verify that $PSCulture is set to 'sv-SE'
- Run any AWS cmdlet that uses AWS services
Logs
With $PSCulture = 'sv-SE':
PS /Users/erikl> Get-EC2Vpc -ProfileName erik -region eu-west-1 -verbose -Debug
DEBUG: Credentials obtained from stored profile named 'erik'
DEBUG: Region obtained from region parameter with value 'eu-west-1'
VERBOSE: Invoking Amazon Elastic Compute Cloud (EC2) operation 'DescribeVpcs' in region 'eu-west-1'
Get-EC2Vpc: Request headers must contain only ASCII characters.
with $PSCulture = 'en-US' or $PSCulture = '':
PS /Users/erikl> Get-EC2Vpc -ProfileName erik -region eu-west-1 -verbose -Debug
DEBUG: Credentials obtained from stored profile named 'erik'
DEBUG: Region obtained from region parameter with value 'eu-west-1'
VERBOSE: Invoking Amazon Elastic Compute Cloud (EC2) operation 'DescribeVpcs' in region 'eu-west-1'
CidrBlock : 172.31.0.0/16
CidrBlockAssociationSet : {vpc-cidr-assoc-1dfa7777}
DhcpOptionsId : dopt-3baf7999
InstanceTenancy : default
Ipv6CidrBlockAssociationSet : {}
IsDefault : True
OwnerId : 123456789012
State : available
Tags : {}
VpcId : vpc-6f741111
Environment
AWS Tools for PowerShell 4.1.7.0.
macOS 11.1 (BigSur)
PowerShell 7.1.1
Tested in Apple Terminal and VS Code terminal, see above.
Resolution
This is a 🐛 bug-report