aws-sdk-js-v3
aws-sdk-js-v3 copied to clipboard
[feature request] Share VERSION of the package in client
Is your feature request related to a problem? Please describe.
- In v2, the version of the package can be viewed by printing VERSION as follows:
const AWS = require("aws-sdk");
console.log(AWS.VERSION);
- As v3 is modular, there's no equivalent global package as per design, and the client package doesn't have key storing it's version number
Describe the solution you'd like
- The client object prints it's version in
VERSIONas follows:
const { S3 } = require("@aws-sdk/client-s3");
console.log(S3.VERSION);
- This applies to the barebones client too:
const { S3Client } = require("@aws-sdk/client-s3");
console.log(S3Client.VERSION);
Describe alternatives you've considered
Running npm list <PACKAGE_NAME> to get the version number in the minimal repro repository as follows:
$ npm list @aws-sdk/client-s3
└─ @aws-sdk/[email protected]
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.
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.
Alternatives is requesting importing package.json directly.
CJS
const { version } = require("@aws-sdk/client-s3/package.json");
console.log(version);
MJS has two options
Use createRequire to require package.json
import { createRequire } from "module"
const require = createRequire(import.meta.url)
const { version } = require("@aws-sdk/client-s3/package.json");
console.log(version);
Default import using import assertions
import packageJson from "@aws-sdk/client-s3/package.json" assert { type: "json" };
console.log(packageJson.version);
Verified that:
- createRequire was added in v12.x: https://nodejs.org/docs/latest-v12.x/api/module.html#module_module_createrequire_filename
import.meta.urlis present in v14.x: https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_import_meta_url
For anyone who comes across this, Lambda team recommended to import version from @aws-sdk/client-s3/package.json as mentioned in this docs.
const { version } = require("@aws-sdk/client-s3/package.json");
exports.handler = async () => ({ version });
Closing the issue.
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.