maintenance_mode_message.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. var warning = [
  2. 'The AWS SDK for JavaScript (v2) will enter maintenance mode',
  3. 'on September 8, 2024 and reach end-of-support on September 8, 2025.\n',
  4. 'Please migrate your code to use AWS SDK for JavaScript (v3).',
  5. 'For more information, check blog post at https://a.co/cUPnyil'
  6. ].join('\n');
  7. module.exports = {
  8. suppress: false
  9. };
  10. /**
  11. * To suppress this message:
  12. * @example
  13. * require('aws-sdk/lib/maintenance_mode_message').suppress = true;
  14. */
  15. function emitWarning() {
  16. if (typeof process === 'undefined')
  17. return;
  18. // Skip maintenance mode message in Lambda environments
  19. if (
  20. typeof process.env === 'object' &&
  21. typeof process.env.AWS_EXECUTION_ENV !== 'undefined' &&
  22. process.env.AWS_EXECUTION_ENV.indexOf('AWS_Lambda_') === 0
  23. ) {
  24. return;
  25. }
  26. if (
  27. typeof process.env === 'object' &&
  28. typeof process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE !== 'undefined'
  29. ) {
  30. return;
  31. }
  32. if (typeof process.emitWarning === 'function') {
  33. process.emitWarning(warning, {
  34. type: 'NOTE'
  35. });
  36. }
  37. }
  38. setTimeout(function () {
  39. if (!module.exports.suppress) {
  40. emitWarning();
  41. }
  42. }, 0);