Cannot find module `'@aws-sdk/credential-provider-process'` for S3 and SNS clients.

See original GitHub issue

Checkboxes for prior research

Describe the bug

I try to upgrade @aws-sdk packages from 3.188.0 to 3.226.0 and as up to 3.224.0 I encountered issue from https://github.com/aws/aws-sdk-js-v3/issues/4075, running clients from 3.226.0 causes that a different message is emitted:

Error: Cannot find module '@aws-sdk/credential-provider-process'
Require stack:
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.226.0/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProcessCredentials.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.226.0/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProfileData.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.226.0/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.226.0/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-node@3.226.0/node_modules/@aws-sdk/credential-provider-node/dist-cjs/defaultProvider.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-node@3.226.0/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js
- /project/node_modules/.pnpm/@aws-sdk+client-sts@3.226.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
- /project/node_modules/.pnpm/@aws-sdk+client-sts@3.226.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
- /project/node_modules/.pnpm/@aws-sdk+client-sts@3.226.0/node_modules/@aws-sdk/client-sts/dist-cjs/STS.js
- /project/node_modules/.pnpm/@aws-sdk+client-sts@3.226.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js
- /project/node_modules/.pnpm/@aws-sdk+client-s3@3.226.0/node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js
- /project/node_modules/.pnpm/@aws-sdk+client-s3@3.226.0/node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js
- /project/node_modules/.pnpm/@aws-sdk+client-s3@3.226.0/node_modules/@aws-sdk/client-s3/dist-cjs/S3.js
- /project/node_modules/.pnpm/@aws-sdk+client-s3@3.226.0/node_modules/@aws-sdk/client-s3/dist-cjs/index.js

I’ve tried to install @aws-sdk/credential-providers but it did not resolve the issue. The issue can be resolved by installing @aws-sdk/credential-provider-process but the docs says clearly:

## Usage
You probably shouldn't, at least directly. Please use [@aws-sdk/credential-providers](https://www.npmjs.com/package/@aws-sdk/credential-providers) instead.

So I believe it is not an intentional flow.

SDK version number

@aws-sdk/package-name@version, …

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

16.13.1 but the same happens on Node 18

Reproduction Steps

Just initialize a SQS client

const { SQS } = require( '@aws-sdk/client-sqs' );

this._sqs = new SQS( config );

Observed Behavior

Error: Cannot find module '@aws-sdk/credential-provider-process'
Require stack:
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.226.0/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProcessCredentials.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.226.0/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProfileData.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.226.0/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-ini@3.226.0/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-node@3.226.0/node_modules/@aws-sdk/credential-provider-node/dist-cjs/defaultProvider.js
- /project/node_modules/.pnpm/@aws-sdk+credential-provider-node@3.226.0/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js
- /project/node_modules/.pnpm/@aws-sdk+client-sts@3.226.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
- /project/node_modules/.pnpm/@aws-sdk+client-sts@3.226.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
- /project/node_modules/.pnpm/@aws-sdk+client-sts@3.226.0/node_modules/@aws-sdk/client-sts/dist-cjs/STS.js
- /project/node_modules/.pnpm/@aws-sdk+client-sts@3.226.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js
- /project/node_modules/.pnpm/@aws-sdk+client-s3@3.226.0/node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js
- /project/node_modules/.pnpm/@aws-sdk+client-s3@3.226.0/node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js
- /project/node_modules/.pnpm/@aws-sdk+client-s3@3.226.0/node_modules/@aws-sdk/client-s3/dist-cjs/S3.js
- /project/node_modules/.pnpm/@aws-sdk+client-s3@3.226.0/node_modules/@aws-sdk/client-s3/dist-cjs/index.js

Expected Behavior

As before 3.188.0 it was possible to use clients without additional credential packages I believe that including required libs is expected. If the lib cannot be included in the client packages, then adding @aws-sdk/credential-providers should resolve the issue.

Possible Solution

No response

Additional Information/Context

No response

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Reactions:1
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
douddlecommented, Dec 12, 2022

Hello, I have similar issue with 3 different AWS SDK libs. I’m using PNPM with no hoisting. Some of dependencies are set as dev dependencies even if they used in the code.

../../node_modules/.pnpm/@aws-sdk+util-dynamodb@3.226.0/node_modules/@aws-sdk/util-dynamodb/dist-types/convertToNative.d.ts:1:32 - error TS2307: Cannot find module '@aws-sdk/client-dynamodb' or its corresponding type declarations.
1 import { AttributeValue } from "@aws-sdk/client-dynamodb";
../../node_modules/.pnpm/@aws-sdk+middleware-endpoint-discovery@3.226.0/node_modules/@aws-sdk/middleware-endpoint-discovery/dist-types/configurations.d.ts:1:39 - error TS2307: Cannot find module '@aws-sdk/node-config-provider' or its corresponding type declarations.
1 import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
../../node_modules/.pnpm/@aws-sdk+middleware-retry@3.226.0/node_modules/@aws-sdk/middleware-retry/dist-types/configurations.d.ts:1:39 - error TS2307: Cannot find module '@aws-sdk/node-config-provider' or its corresponding type declarations.
1 import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
../../node_modules/.pnpm/@aws-sdk+config-resolver@3.226.0/node_modules/@aws-sdk/config-resolver/dist-types/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts:1:39 - error TS2307: Cannot find module '@aws-sdk/node-config-provider' or its corresponding type declarations.
1 import { LoadedConfigSelectors } from "@aws-sdk/node-config-provider";
0reactions
dszczepaniak-cksourcecommented, Dec 21, 2022

@mhassan1 I can confirm https://github.com/aws/aws-sdk-js-v3/pull/4302 resolved the issue, thank you for your help! I close the issue as completed. Also @RanVaknin thanks for your involvement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module '@aws-sdk/client-sns' - Stack Overflow
I updated my node version to 12.X and now it's able to find the library. So, I can say that V3 requires node...
Read more >
AWS SDK for JavaScript v3
Amazon S3 Object Integrity. If the required AWS Common Runtime components are not installed you will receive an error like: Cannot find module...
Read more >
Be Alerted When an Amazon S3 File is Missing ... - YouTube
Your browser can't play this video. ... Be Alerted When an Amazon S3 File is Missing Using Lambda, SNS, and EventBridge.
Read more >
Be Alerted When an Amazon S3 File is Missing ... - PMsquare
Creating an Alert When S3 Files Are Missing · 1) Create an SNS topic. · 2) Enter a name for your topic and...
Read more >
Amazon Web Services aws-sdk-js-v3 Issues - Giters
aws/aws-sdk-js-v3 Issues · Unable to download latest version from npm · Cannot find module `'@aws-sdk/credential-provider-process'` for S3 and SNS clients.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found