Commit 0260808 1 parent 050469e commit 0260808 Copy full SHA for 0260808
File tree 1 file changed +10
-14
lines changed
test/versioned/aws-sdk-v3
1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -13,20 +13,16 @@ const createAiResponseServer = require('../../lib/aws-server-stubs/ai-server')
13
13
const { FAKE_CREDENTIALS } = require ( '../../lib/aws-server-stubs' )
14
14
const { DESTINATIONS } = require ( '../../../lib/config/attribute-filter' )
15
15
16
- const pkgVersion = ( function ( ) {
17
- try {
18
- const { version } = require ( '@smithy/smithy-client/package.json' )
19
- return version
20
- } catch {
21
- try {
22
- const {
23
- version
24
- } = require ( './node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/smithy-client/package.json' )
25
- return version
26
- } catch { }
27
- }
28
- /* eslint-disable-next-line */
29
- } ( ) )
16
+ // The shim will utilize the version of `@smithy/smithy-client` that is required
17
+ // by the `@aws-sdk/client-bedrock-runtime` module to set the version string
18
+ // on metrics. So we want to require that specific version instead of the one
19
+ // in our dependency tree. We can't use `require.resolve('mod', { paths: [] })`
20
+ // here because that appends the paths to the lookup tree instead of prepending
21
+ // them. Thus, we will still occasionally resolve to the module in our tree
22
+ // instead of the one in the test suite's tree.
23
+ const {
24
+ version : pkgVersion
25
+ } = require ( './node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/smithy-client/package.json' )
30
26
31
27
const requests = {
32
28
ai21 : ( prompt , modelId ) => ( {
You can’t perform that action at this time.
0 commit comments