Replies: 7 comments
-
Hi @nwehner
However, they will be read only once at construction. |
Beta Was this translation helpful? Give feedback.
-
Good to know! Is there a list somewhere of all the properties that would need to be populated off-disk? I made a small edit to the slurpFile function to reject the promise right away, rather than trying to readFile and resolving the promise with that data. When Gatsby's building everything with Webpack, I get an UnhandledPromiseRejectionWarning regarding the rejection I introduced. So, even with credentials and region populated in the SecretsManager options, the program is trying to get something off-disk. |
Beta Was this translation helpful? Give feedback.
-
Did some more logging and I can confirm it's trying to grab my |
Beta Was this translation helpful? Give feedback.
-
I tried initializing the SecretsManagerClient with every configuration option I could find, but the program is still trying to grab my
|
Beta Was this translation helpful? Give feedback.
-
I believe we're seeing the same issue with the S3 client. Setting AWS_SDK_LOAD_CONFIG=0 has no effect. |
Beta Was this translation helpful? Give feedback.
-
This causes Lambda to fail on heavy load:
|
Beta Was this translation helpful? Give feedback.
-
Starting in february 2022, after the previous comment, readFile's result was cached - it only performs the file read for a given file the first time that file path is requested (even if there are multiple concurrent requests for the same file). Before, it would call fs.readFile every time https://github.com/aws/aws-sdk-js-v3/commits/main/packages/shared-ini-file-loader/src/slurpFile.ts 7b8954d#diff-322e53a7185a2b9b43ad5415ea1b6ffe0c5fd1f0858a58dae9d6b9b10d375a8d https://github.com/aws/aws-sdk-js-v3/blob/main/packages/shared-ini-file-loader/src/getHomeDir.ts - it's still calling os.homedir() repeatedly, which is separate from the readFile bug. Is it safe to cache that (e.g. maybe conditionally on uid)? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
Despite creating a new SecretsManagerClient with credentials included in the initialization options, the program uses fs.readFile to grab credentials off-disk. The SecretsManagerClient should be using the provided credentials and thus not use fs.readFile at all.
Your environment
aws/codebuild/standard:4.0 Linux image with npm@7.7.5 and node@12.18.0
SDK version number
@aws-sdk/client-s3@3.13.0
Is the issue in the browser/Node.js/ReactNative?
Node.js
Details of the browser/Node.js/ReactNative version
Paste output of
npx envinfo --browsers
ornode -v
orreact-native -v
v12.18.0
Steps to reproduce
If you create a new SecretsManagerClient like so
new SecretsManagerClient({ region: 'us-west-2', credentials: { accessKeyId: 'myAccessKey', secretAccessKey: 'mySecretKey' } })
and proceed to resolve the Promise, the
slurpFile
function from @aws-sdk/shared-ini-file-loader is used to grab credentials off the file system.Observed behavior
While building a new Webpack project with SecretsManagerClient included therein, Webpack warns that there is "Unsafe builtin usage fs.readFile" pointing to the slurfFile function in @aws-sdk/shared-ini-file-loader/dist/es/index.js:87:17
Expected behavior
fs.readFile should not be invoked at all since credentials are passed to the client during initialization.
Additional context
This might possibly be related to #2027
Beta Was this translation helpful? Give feedback.
All reactions