cloudydeno / deno-aws_api

From-scratch Typescript client for accessing AWS APIs
https://deno.land/x/aws_api
60 stars 3 forks source link

Error when running with Deno 1.5.1 #14

Closed runlevel5 closed 3 years ago

runlevel5 commented 3 years ago

Code

#!/usr/bin/env -S deno run --unstable --allow-env --allow-run --allow-net

import { ApiFactory } from "https://deno.land/x/aws_api@v0.5.0/client/mod.ts";
import { S3 } from "https://aws-api.deno.dev/v0.2/services/s3.ts";

const makeS3Client = async () => {
  const factory = new ApiFactory({
    region: AWS_REGION,
    credentials: {
      awsAccessKeyId: AWS_ACCESS_KEY_ID,
      awsSecretKey: AWS_SECRET_ACCESS_KEY,
      sessionToken: AWS_SESSION_TOKEN,
      expiresAt: AWS_SESSION_EXPIRATION
    }
  });

  await factory.ensureCredentialsAvailable();
  return factory.makeNew(S3);
}

(async function () {
  const s3 = makeS3Client()
})()

Expected

No error

Actual

error: TS18022 [ERROR]: A method cannot be named with a private identifier.
  async #performRawRequest(opts: {
        ~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/aws_api@v0.5.0/client/instance-metadata.ts:65:9
danopia commented 3 years ago

Hey, thanks for writing in. This definitely doesn't surprise me. I generally test the last 3 to 5 minor versions of Deno in my CI. Is there a reason you're using Deno 1.5.1, which shipped around 12 months ago?

The latest version I tested against Deno 1.5 is /x/aws_api@v0.2.1 which is from a similar period. It's also possible that an in-between release would work for your needs too, but that's untested. /x/aws_api@v0.5.0 requires Deno v1.11 or later for full functionality due to #6.

jtoppine commented 3 years ago

The timing makes me suspect the OP meant not 1.5.1 but 1.15.1, as the latter was released just today

danopia commented 3 years ago

The timing makes me suspect the OP meant not 1.5.1 but 1.15.1, as the latter was released just today

This would make sense, and maybe there is some confusion around a typo, but the reported error message is definitely something Deno v1.5.1 throws:

~> deno upgrade --version 1.5.1
[...]
Deno is upgrading to version 1.5.1
[...]

~> deno run https://raw.githubusercontent.com/cloudydeno/deno-aws_api/main/lib/client/mod.ts
Check https://raw.githubusercontent.com/cloudydeno/deno-aws_api/main/lib/client/mod.ts
error: TS18022 [ERROR]: A method cannot be named with a private identifier.
  async #performRawRequest(opts: {
        ~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/cloudydeno/deno-aws_api/main/lib/client/instance-metadata.ts:65:9
~> 

while v1.15.1 is fine:

~> deno upgrade
[...]
Deno is upgrading to version 1.15.1
[...]

~> deno run https://raw.githubusercontent.com/cloudydeno/deno-aws_api/main/lib/client/mod.ts
Check https://raw.githubusercontent.com/cloudydeno/deno-aws_api/main/lib/client/mod.ts
~> 

Maybe OP installed the wrong version today 😅

runlevel5 commented 3 years ago

Mine is 1.5.1 not 1.15.1 so it is old.

I will upgrade to 1.13 instead.