Closed KeithGillette closed 1 year ago
Possibly because of stripInternal tsconfig.
The internal types are not stripped for types in profile.ts
$ pwd
/local/home/trivikr/workspace/aws-sdk-js-v3/packages/types
$ yarn clean && yarn build
...
$ cat dist-types/profile.d.ts
/**
* @internal
*/
export interface Profile {
[key: string]: string | undefined;
}
/**
* @internal
*/
export interface ParsedIniData {
[key: string]: Profile;
}
/**
* @internal
*/
export interface SharedConfigFiles {
credentialsFile: ParsedIniData;
configFile: ParsedIniData;
}
I'm not sure why this issue is happening. It's possibly due to stripInternal
configuration in @aws-sdk/signature-v4
https://github.com/aws/aws-sdk-js-v3/blob/4377e4488ce4ae3746dd34349ab3d95d5780fa91/packages/signature-v4/tsconfig.cjs.json#L6
I was not able to repro with the following project setup:
I've removed @internal tag from profile types in https://github.com/aws/aws-sdk-js-v3/pull/3452 though.
Was #3452 released in version 3.55.0, @trivikr? If so, it does not resolve the issue for me, as I get the same error running tsc
(4.6.2) against a project built with 3.55.0. Reverting to 3.54.0 prevents the following errors:
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/loadSharedConfigFiles.d.ts:1:10 - error TS2305: Module '"@aws-sdk/types"' has no exported member 'SharedConfigFiles'.
1 import { SharedConfigFiles } from "@aws-sdk/types";
~~~~~~~~~~~~~~~~~
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/parseKnownFiles.d.ts:1:10 - error TS2305: Module '"@aws-sdk/types"' has no exported member 'ParsedIniData'.
1 import { ParsedIniData, SharedConfigFiles } from "@aws-sdk/types";
~~~~~~~~~~~~~
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/parseKnownFiles.d.ts:1:25 - error TS2305: Module '"@aws-sdk/types"' has no exported member 'SharedConfigFiles'.
1 import { ParsedIniData, SharedConfigFiles } from "@aws-sdk/types";
~~~~~~~~~~~~~~~~~
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts:1:10 - error TS2305: Module '"@aws-sdk/types"' has no exported member 'ParsedIniData'.
1 import { ParsedIniData as __ParsedIniData, Profile as __Profile, SharedConfigFiles as __SharedConfigFiles } from "@aws-sdk/types";
~~~~~~~~~~~~~
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts:1:44 - error TS2305: Module '"@aws-sdk/types"' has no exported member 'Profile'.
1 import { ParsedIniData as __ParsedIniData, Profile as __Profile, SharedConfigFiles as __SharedConfigFiles } from "@aws-sdk/types";
~~~~~~~
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts:1:66 - error TS2305: Module '"@aws-sdk/types"' has no exported member 'SharedConfigFiles'.
1 import { ParsedIniData as __ParsedIniData, Profile as __Profile, SharedConfigFiles as __SharedConfigFiles } from "@aws-sdk/types";
~~~~~~~~~~~~~~~~~
Found 6 errors in 3 files.
Errors Files
1 node_modules/@aws-sdk/shared-ini-file-loader/dist-types/loadSharedConfigFiles.d.ts:1
2 node_modules/@aws-sdk/shared-ini-file-loader/dist-types/parseKnownFiles.d.ts:1
3 node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts:1
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"importHelpers": true,
"lib": [
"ES2018",
"dom"
],
"module": "es2020",
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "./dist/out-tsc",
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"strictNullChecks": false,
"suppressImplicitAnyIndexErrors": true,
"target": "es2015"
}
}
Running into this problem as well with 3.54.1 and 3.55.0 of the @aws-sdk/client-s3
:
40 packages are looking for funding
run `npm fund` for details
found 11 high severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
> svg_rasterizer_lambda@1.1.22 build /var/task
> tsc
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/loadSharedConfigFiles.d.ts(1,10): error TS2305: Module '"@aws-sdk/types"' has no exported member 'SharedConfigFiles'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/parseKnownFiles.d.ts(1,10): error TS2305: Module '"@aws-sdk/types"' has no exported member 'ParsedIniData'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/parseKnownFiles.d.ts(1,25): error TS2305: Module '"@aws-sdk/types"' has no exported member 'SharedConfigFiles'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts(1,10): error TS2305: Module '"@aws-sdk/types"' has no exported member 'ParsedIniData'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts(1,44): error TS2305: Module '"@aws-sdk/types"' has no exported member 'Profile'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts(1,66): error TS2305: Module '"@aws-sdk/types"' has no exported member 'SharedConfigFiles'.
And this caused by the s3-client, cause the other upgrades of the dependencies all work without issue, but as soon as I push @aws-sdk/s3-client
above 3.54.0 this issue pops up.
I was able to get around this with npm i —save-dev @aws-sdk/types
so that 3.55.0 (or whatever version is specified in package.json) is always used.
Can confirm that npm i @aws-sdk/types
allows to build our Docker Lambda images again.
So one of the packages in the SDK doesn't seem to be using the correct version.
Given the error messages I receive and the timing of their appearance with version 3.54.1, I suspect the issue originated in commit #ad6890d9eb58da4c2e192a461f78a57a5fc53f75, which added @aws-sdk/types
in the shared-ini-file-loader
package.json
devDependencies
. When I look at other packages and libraries from those installed in my project, such as client-s3
, s3-request-presigner
, util-create-request
, util-format-url
, @aws-sdk/types
is instead included in package.json
dependencies
, not devDependencies
.
This is error persists in our project through the past 19 releases, including 3.72.0. I've tested a build moving aws-sdk/types
from devDependencies
to dependencies
in the shared-ini-file-loader
package.json
, so my previous surmise seems incorrect, though I believe the specified commit caused the incompatibility.
When I look at the version of @aws-sdk/types
actually installed, it's 3.1.0
even though all of the aws-sdk
packages installed in node_modules
specify *
, which currently resolves to 3.5.5
, so I also suspect @coding-bunny's guess is not quite right, either.
I believe the culprit in our project is @aws-crypto/sha256-browser@2.0.1
(latest), which calls for @aws-sdk/types@^3.1.0
in its package.json
dependencies
, so I'm opening an issue in that repository referencing this one. The workaround reported by @jbalbien of forcing installation of @aws-sdk/types@latest
by adding it as an development dependency does work, so hopefully a simple update of @aws-sdk/types
in @aws-crypto/*
dependencies will work without code changes.
I should probably just make @aws-sdk/types
a dependency of my project as a work-around and be done with it but I'm still confused by this source of this error. While the outdated version (@aws-sdk/types@3.1.0
) that is installed in my project matches that called for by @aws/aws-sdk-crypto-helpers
as previous noted, I realize that the caret in the @aws/aws-sdk-crypto-helpers
dependency entries: @aws-sdk/types@^3.1.0
should install the latest compatible version if I understand npm
behavior correctly. However, npm
is not installing what NPMJS shows as the latest version: @aws-sdk/types@3.55.0
.
Moreover, as I reported before, when I look at the errors generated by tsc
with the default tsconfig.json
skipLibCheck: false
, they all stem from @aws-sdk/shared-ini-file-loader
, which specifies @aws-sdk/types: *
in its package.json
dependencies. As I understand it, *
will match any release since 0.0.0. Since the move of types in @aws-sdk/@3.54.1
, however, I believe that wildcard version specification incorrect, since the following types don't exist in @aws-sdk/types
prior to 3.54.1. So shouldn't @aws-sdk/shared-ini-file-loader
specify @aws-sdk/types@^3.54.1
as its minimum requirement?
tsc
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/loadSharedConfigFiles.d.ts(1,10): error TS2305: Module '"@aws-sdk/types"' has no exported member 'SharedConfigFiles'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/parseKnownFiles.d.ts(1,10): error TS2305: Module '"@aws-sdk/types"' has no exported member 'ParsedIniData'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts(1,10): error TS2305: Module '"@aws-sdk/types"' has no exported member 'ParsedIniData'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts(1,44): error TS2305: Module '"@aws-sdk/types"' has no exported member 'Profile'.
node_modules/@aws-sdk/shared-ini-file-loader/dist-types/types.d.ts(1,66): error TS2305: Module '"@aws-sdk/types"' has no exported member 'SharedConfigFiles'.
npx npm-why @aws-sdk/types
Who required @aws-sdk/types:
MyProject > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-crypto/sha256-browser > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-crypto/sha256-browser > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-crypto/sha1-browser > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-crypto/sha256-browser > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-crypto/sha256-browser > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/client-sts > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-ini > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-browser > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-js > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/credential-provider-node > @aws-sdk/credential-provider-sso > @aws-sdk/client-sso > @aws-crypto/sha256-js > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/eventstream-serde-browser > @aws-sdk/eventstream-marshaller > @aws-crypto/crc32 > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/eventstream-serde-browser > @aws-sdk/eventstream-marshaller > @aws-crypto/crc32 > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/eventstream-serde-browser > @aws-sdk/eventstream-serde-universal > @aws-sdk/eventstream-marshaller > @aws-crypto/crc32 > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/eventstream-serde-browser > @aws-sdk/eventstream-serde-universal > @aws-sdk/eventstream-marshaller > @aws-crypto/crc32 > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/eventstream-serde-node > @aws-sdk/eventstream-marshaller > @aws-crypto/crc32 > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/eventstream-serde-node > @aws-sdk/eventstream-marshaller > @aws-crypto/crc32 > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/eventstream-serde-node > @aws-sdk/eventstream-serde-universal > @aws-sdk/eventstream-marshaller > @aws-crypto/crc32 > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/eventstream-serde-node > @aws-sdk/eventstream-serde-universal > @aws-sdk/eventstream-marshaller > @aws-crypto/crc32 > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/middleware-flexible-checksums > @aws-crypto/crc32 > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/middleware-flexible-checksums > @aws-crypto/crc32 > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/middleware-flexible-checksums > @aws-crypto/crc32c > @aws-crypto/util > @aws-sdk/types@3.1.0
MyProject > @aws-sdk/client-s3 > @aws-sdk/middleware-flexible-checksums > @aws-crypto/crc32c > @aws-sdk/types@3.1.0
I faced a similar issue today after installing @aws-sdk/client-lambda
(latest).
Fixed it by installing @aws-sdk/types
.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Describe the bug
Running
tsc
on a project with the defaulttsconfig.json
skipLibCheck: false
produces multiple TS2305 errors.Your environment
SDK version number
Is the issue in the browser/Node.js/ReactNative?
TypeScript transpilation
Details of the browser/Node.js/ReactNative version
node@14.18.3
Steps to reproduce
Executing
tsc
on project dependent upon the@aws-sdk
libraries listed above.Observed behavior
Expected behavior
Project should transpile without error as before update.