christophgysin / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Random new typescript issue

matthew-devika opened this issue · comments

Describe the bug
I am running into TypeScript issues all of a sudden with v0.0.5 (and subsequentially 0.0.4 + 0.0.6) where there is a typescript issue in https://deno.land/x/aws_sdk@v0.0.5/shared-ini-file-loader/mod.ts:103:17

Download https://jspm.dev/npm:@jspm/core@2.0.0-beta.7/nodelibs/events
Check file:///opt/atlassian/pipelines/agent/build/secrets/setup-secrets.ts
error: TS2345 [ERROR]: Argument of type 'string | undefined' is not assignable to parameter of type 'string | PromiseLike<string>'.
  Type 'undefined' is not assignable to type 'string | PromiseLike<string>'.
        resolve(data);
                ~~~~
    at https://deno.land/x/aws_sdk@v0.0.5/shared-ini-file-loader/mod.ts:103:17

SDK version number
0.0.5 - this was working for the last few weeks, all of a sudden it has stopped today, which tells me it's a remote problem.
I have tested with same negative results in 0.0.4 and 0.0.6.

Is the issue in the browser/Node.js/ReactNative?
Deno / Node.JS

Details of the browser/Deno/Node.js/ReactNative version
Deno: 1.6.x
NodeJS: 12.x

To Reproduce (observed behavior)

Import some libraries from sdk and run deno:

~/.deno/bin/deno run --allow-env --allow-read --allow-net --unstable ./some-deno-script.ts

import { SecretsManager } from 'https://deno.land/x/aws_sdk@v0.0.5/client-secrets-manager/SecretsManager.ts';
import {
  CreateSecretRequest,
  ListSecretsRequest,
  ListSecretsResponse,
  SecretListEntry,
  UpdateSecretRequest,
} from 'https://deno.land/x/aws_sdk@v0.0.5/client-secrets-manager/models/index.ts';
import 'https://deno.land/x/dotenv/load.ts';

...

Expected behavior
Build does not error

Screenshots
N/A

Additional context
Running in BitBucket pipelines as a part of our CI/CD

Note: adding --no-check overcomes this issue but is dangerous to use I believe.

Can't reproduce:

$ cat some-deno-script.ts 
import { SecretsManager } from 'https://deno.land/x/aws_sdk@v0.0.5/client-secrets-manager/SecretsManager.ts';
import {
  CreateSecretRequest,
  ListSecretsRequest,
  ListSecretsResponse,
  SecretListEntry,
  UpdateSecretRequest,
} from 'https://deno.land/x/aws_sdk@v0.0.5/client-secrets-manager/models/index.ts';
import 'https://deno.land/x/dotenv/load.ts';
$ deno run --allow-env --allow-read --allow-net --unstable ./some-deno-script.ts
Download https://deno.land/x/dotenv/load.ts
Download https://deno.land/x/aws_sdk@v0.0.5/client-secrets-manager/SecretsManager.ts
Download https://deno.land/x/aws_sdk@v0.0.5/client-secrets-manager/models/index.ts
Warning Implicitly using latest version (v1.0.1) for https://deno.land/x/dotenv/load.ts
[...]
Check file:///home/chris/projects/aws-sdk-js-v3/tests/deno/some-deno-script.ts

Also, we should probably update the issue template (this is a fork of aws/aws-sdk-js-v3), but could you provide the deno version instead of Node.js?

@christophgysin Ah sorry, we just download the latest Deno during pipelines, so at the time of this issue being raised it was 1.6.0

Test either fails or succeeds based on deno version 1.5.4 (succeeds) or v 1.6.0 (fails):

$ cat /tmp/aws-sdk-test.ts 
import { SecretsManager } from 'https://deno.land/x/aws_sdk@v0.0.5/client-secrets-manager/SecretsManager.ts';
import {
  CreateSecretRequest,
  ListSecretsRequest,
  ListSecretsResponse,
  SecretListEntry,
  UpdateSecretRequest,
} from 'https://deno.land/x/aws_sdk@v0.0.5/client-secrets-manager/models/index.ts';
import 'https://deno.land/x/dotenv/load.ts';

$ deno upgrade --version 1.5.4
Version 1.5.4 is already installed
$ deno run --allow-env --allow-read --allow-net --unstable /tmp/aws-sdk-test.ts
$ # OK

$ deno upgrade --version 1.6.0
$ deno run --allow-env --allow-read --allow-net --unstable /tmp/aws-sdk-test.ts 
Check file:///tmp/aws-sdk-test.ts
error: TS2345 [ERROR]: Argument of type 'string | undefined' is not assignable to parameter of type 'string | PromiseLike<string>'.
  Type 'undefined' is not assignable to type 'string | PromiseLike<string>'.
        resolve(data);
                ~~~~
    at https://deno.land/x/aws_sdk@v0.0.5/shared-ini-file-loader/mod.ts:103:17

That'll do it. TY

I just pushed a new version v0.0.7 that should fix the issue with deno-1.6.0.

@matthew-devika Can you confirm if this fixes the issue for you?

Closing due to inactivity.