deno-aws_api
deno-aws_api copied to clipboard
Error when making AWS API calls on windows
First of all thank you for making this module, it is very nice! I noticed that on windows there is an error when trying to load the AWS credentials. My credentials are located in the default location for the file on windows C:\Users\<MyUser>\.aws\credentials
and this is an example of code that errors:
import { ApiFactory } from 'https://deno.land/x/[email protected]/client/mod.ts';
import { CloudFormation } from "https://aws-api.deno.dev/v0.3/services/cloudformation.ts";
const cfn = new ApiFactory({
region: 'eu-west-3'
}).makeNew(CloudFormation);
const result = await cfn.describeStacks();
console.log(result);
Error:
deno run -A .\life.ts
error: Uncaught (in promise) Error: Failed to load any possible AWS credentials:
- ()=>new EnvironmentCredentials('AWS') Error: AWS environment variables not set
- ()=>new EnvironmentCredentials('AMAZON') Error: AMAZON environment variables not set
- ()=>new SharedIniFileCredentials() NotFound: The system cannot find the path specified. (os error 3)
- ()=>new EcsTaskCredentials() Error: AWS_CONTAINER_CREDENTIALS_RELATIVE_URI not set
- ()=>new TokenFileWebIdentityCredentials() Error: No WebIdentityToken file path is set
- ()=>new EC2MetadataCredentials() TypeError: error sending request for url (http://169.254.169.254/latest/api/token): error trying to connect: tcp connect error: A socket operation was attempted to an unreachable network. (os error 10051)
return Promise.reject(new Error([
^
at CredentialsProviderChain.getCredentials (https://deno.land/x/[email protected]/client/credentials.ts:44:27)
at async QueryServiceClient.signingFetcher [as signedFetcher] (https://deno.land/x/[email protected]/client/client.ts:89:29)
at async QueryServiceClient.performRequest (https://deno.land/x/[email protected]/client/client.ts:179:22)
at async CloudFormation.describeStacks (https://aws-api.deno.dev/v0.3/services/cloudformation.ts:606:18)
at async file:///C:/Users/GJZwiers/repos/deno_deno/life.ts:8:16
I also use WSL (Ubuntu) with credentials at ~/.aws/credentials
and on there it works as normal.
Hi, thanks for the report! This is likely the same exact issue that my /x/kubernetes_client library had on Windows. I can't say I'm surprised, I included a TODO comment: https://github.com/cloudydeno/deno-aws_api/blob/3ce25f2e9fb1f547bad61afdaa4676f60ddce497/lib/client/credentials.ts#L86-L88
Anyway, I've started a fix:
- #41
To test the fix, please use this import:
import { ApiFactory } from 'https://raw.githubusercontent.com/cloudydeno/deno-aws_api/4a9d5be8044abdc7d2d50186e9e9c0775d09d9a2/lib/client/mod.ts';
I've just tried it out, it looks like it fixed the issue. Working on both windows and WSL now
Great, thanks for reporting back! :)
I should be able to get a release out sometime this week, depends on what else needs work while I'm in the area
🚀 This fix finally shipped in a tag today: v0.8.0