@sentry/craft 2.27.1 → 2.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/craft +67 -23
  2. package/package.json +1 -1
package/dist/craft CHANGED
@@ -157867,7 +157867,7 @@ var require_dist_cjs63 = __commonJS({
157867
157867
  Trace: "TRACE",
157868
157868
  Warn: "WARN"
157869
157869
  };
157870
- var Architecture = {
157870
+ var Architecture2 = {
157871
157871
  arm64: "arm64",
157872
157872
  x86_64: "x86_64"
157873
157873
  };
@@ -158211,7 +158211,7 @@ var require_dist_cjs63 = __commonJS({
158211
158211
  exports2.AllowedPublishers$ = AllowedPublishers$;
158212
158212
  exports2.AmazonManagedKafkaEventSourceConfig$ = AmazonManagedKafkaEventSourceConfig$;
158213
158213
  exports2.ApplicationLogLevel = ApplicationLogLevel;
158214
- exports2.Architecture = Architecture;
158214
+ exports2.Architecture = Architecture2;
158215
158215
  exports2.CallbackDetails$ = CallbackDetails$;
158216
158216
  exports2.CallbackFailedDetails$ = CallbackFailedDetails$;
158217
158217
  exports2.CallbackOptions$ = CallbackOptions$;
@@ -158819,7 +158819,7 @@ async function getRegionsFromAws() {
158819
158819
  function getAccountFromArn(arn) {
158820
158820
  return arn.split(ARN_SEPARATOR)[ARN_ACCOUNT_INDEX];
158821
158821
  }
158822
- var import_aws4, import_node_fetch4, import_client_lambda, RUNTIME_CANONICAL_PREFIX, ARN_SEPARATOR, ARN_ACCOUNT_INDEX, AwsLambdaLayerManager;
158822
+ var import_aws4, import_node_fetch4, import_client_lambda, RUNTIME_CANONICAL_PREFIX, ARN_SEPARATOR, ARN_ACCOUNT_INDEX, AWS_MAX_ATTEMPTS, AwsLambdaLayerManager;
158823
158823
  var init_awsLambdaLayerManager = __esm({
158824
158824
  "src/utils/awsLambdaLayerManager.ts"() {
158825
158825
  "use strict";
@@ -158828,13 +158828,17 @@ var init_awsLambdaLayerManager = __esm({
158828
158828
  import_aws4 = __toESM(require_aws4());
158829
158829
  import_node_fetch4 = __toESM(require_lib9());
158830
158830
  import_client_lambda = __toESM(require_dist_cjs63());
158831
+ init_esm9();
158831
158832
  init_logger2();
158832
158833
  RUNTIME_CANONICAL_PREFIX = "aws-layer:";
158833
158834
  ARN_SEPARATOR = ":";
158834
158835
  ARN_ACCOUNT_INDEX = 4;
158836
+ AWS_MAX_ATTEMPTS = 3;
158835
158837
  AwsLambdaLayerManager = class {
158836
158838
  /** Compatible runtimes with the new layer. */
158837
158839
  runtime;
158840
+ /** Compatible architectures with the new layer. */
158841
+ compatibleArchitectures;
158838
158842
  /** Regions to publish the layer to. */
158839
158843
  awsRegions = [];
158840
158844
  /** Name of the layer to be published. */
@@ -158847,13 +158851,14 @@ var init_awsLambdaLayerManager = __esm({
158847
158851
  verboseInfo = true;
158848
158852
  /** Version of the SDK. */
158849
158853
  sdkVersion;
158850
- constructor(runtime, layerName, license, artifactBuffer, awsRegions, sdkVersion) {
158854
+ constructor(runtime, layerName, license, artifactBuffer, awsRegions, sdkVersion, compatibleArchitectures) {
158851
158855
  this.runtime = runtime;
158852
158856
  this.layerName = layerName;
158853
158857
  this.license = license;
158854
158858
  this.artifactBuffer = artifactBuffer;
158855
158859
  this.awsRegions = awsRegions;
158856
158860
  this.sdkVersion = sdkVersion;
158861
+ this.compatibleArchitectures = compatibleArchitectures;
158857
158862
  }
158858
158863
  /**
158859
158864
  * Publishes an AWS Lambda layer to the given region.
@@ -158862,13 +158867,19 @@ var init_awsLambdaLayerManager = __esm({
158862
158867
  */
158863
158868
  async publishLayerToRegion(region) {
158864
158869
  logger.debug(`Publishing layer to ${region}...`);
158865
- const lambda = new import_client_lambda.Lambda({ region });
158870
+ const lambda = new import_client_lambda.Lambda({
158871
+ region,
158872
+ maxAttempts: AWS_MAX_ATTEMPTS
158873
+ });
158866
158874
  const publishedLayer = await lambda.publishLayerVersion({
158867
158875
  Content: {
158868
158876
  ZipFile: this.artifactBuffer
158869
158877
  },
158870
158878
  LayerName: this.layerName,
158871
158879
  CompatibleRuntimes: this.runtime.versions,
158880
+ ...this.compatibleArchitectures?.length ? {
158881
+ CompatibleArchitectures: this.compatibleArchitectures
158882
+ } : {},
158872
158883
  LicenseInfo: this.license,
158873
158884
  Description: `Sentry AWS Serverless SDK v${this.sdkVersion}`
158874
158885
  });
@@ -158891,25 +158902,46 @@ var init_awsLambdaLayerManager = __esm({
158891
158902
  }
158892
158903
  /**
158893
158904
  * Publishes new AWS Lambda layers to all the regions.
158894
- *
158895
- * @returns Array of the published layers.
158905
+ * Failed regions are reported, but do not block the release.
158906
+ * @returns Array of the successfully published layers.
158896
158907
  */
158897
158908
  async publishToAllRegions() {
158898
- const publishedLayers = await Promise.all(
158909
+ const results = await Promise.all(
158899
158910
  this.awsRegions.map(async (region) => {
158900
158911
  try {
158901
- return await this.publishLayerToRegion(region);
158912
+ const layer = await this.publishLayerToRegion(region);
158913
+ return { region, layer };
158902
158914
  } catch (error3) {
158903
- logger.warn(
158904
- `Something went wrong with AWS trying to publish to region ${region}: ${error3.message}`
158905
- );
158906
- return void 0;
158915
+ return {
158916
+ region,
158917
+ error: error3 instanceof Error ? error3 : new Error(String(error3))
158918
+ };
158907
158919
  }
158908
158920
  })
158909
158921
  );
158910
- return publishedLayers.filter((layer) => {
158911
- return layer !== void 0;
158912
- });
158922
+ const failed = results.filter(
158923
+ (result) => "error" in result
158924
+ );
158925
+ if (failed.length) {
158926
+ const summary = `Layer published with ${failed.length} failed region(s) for ${this.runtime.name}: ${failed.map((f5) => f5.region).join(", ")}`;
158927
+ logger.error(summary);
158928
+ for (const { region, error: error3 } of failed) {
158929
+ logger.error(` ${region}: ${error3.message}`);
158930
+ }
158931
+ captureException(new Error(summary), {
158932
+ extra: {
158933
+ runtime: this.runtime.name,
158934
+ sdkVersion: this.sdkVersion,
158935
+ failedRegions: failed.map((f5) => ({
158936
+ region: f5.region,
158937
+ message: f5.error.message
158938
+ }))
158939
+ }
158940
+ });
158941
+ }
158942
+ return results.filter(
158943
+ (result) => "layer" in result
158944
+ ).map((result) => result.layer);
158913
158945
  }
158914
158946
  /**
158915
158947
  * Returns the canonical name of the current lambda layer.
@@ -159141,6 +159173,7 @@ v${version2} for ${runtimeNames}`
159141
159173
  const resolvedLayerName = this.resolveLayerName(version2);
159142
159174
  this.logger.debug(`Resolved layer name: ${resolvedLayerName}`);
159143
159175
  const config3 = this.config;
159176
+ const compatibleArchitectures = config3.compatibleArchitectures;
159144
159177
  await Promise.all(
159145
159178
  config3.compatibleRuntimes.map(async (runtime) => {
159146
159179
  this.logger.debug(`Publishing runtime ${runtime.name}...`);
@@ -159150,7 +159183,8 @@ v${version2} for ${runtimeNames}`
159150
159183
  config3.license,
159151
159184
  artifactBuffer,
159152
159185
  awsRegions,
159153
- version2
159186
+ version2,
159187
+ compatibleArchitectures
159154
159188
  );
159155
159189
  let publishedLayers = [];
159156
159190
  try {
@@ -159193,8 +159227,12 @@ v${version2} for ${runtimeNames}`
159193
159227
  sdk_version: version2,
159194
159228
  account_number: getAccountFromArn(publishedLayers[0].arn),
159195
159229
  layer_name: resolvedLayerName,
159196
- regions: regionsVersions
159230
+ regions: regionsVersions,
159231
+ compatible_runtimes: runtime.versions
159197
159232
  };
159233
+ if (compatibleArchitectures?.length) {
159234
+ runtimeData.compatible_architectures = compatibleArchitectures;
159235
+ }
159198
159236
  const baseFilepath = path15.posix.join(
159199
159237
  runtimeBaseDir,
159200
159238
  this.BASE_FILENAME
@@ -160517,9 +160555,15 @@ async function pushArchiveToGitRepository({
160517
160555
  );
160518
160556
  throw e4;
160519
160557
  }
160520
- if (parsedUrl.host === "github.com" && process.env.GITHUB_API_TOKEN) {
160521
- logger3?.info("Using provided github PAT token for authentication.");
160522
- parsedUrl.username = process.env.GITHUB_API_TOKEN;
160558
+ if (parsedUrl.host === "github.com") {
160559
+ const ghToken = process.env.GITHUB_API_TOKEN || process.env.GITHUB_TOKEN;
160560
+ if (ghToken) {
160561
+ logger3?.info("Using provided github PAT token for authentication.");
160562
+ parsedUrl.password = ghToken;
160563
+ if (!parsedUrl.username) {
160564
+ parsedUrl.username = "x-access-token";
160565
+ }
160566
+ }
160523
160567
  }
160524
160568
  const authenticatedUrl = parsedUrl.toString();
160525
160569
  const git = await cloneRepo(authenticatedUrl, directory);
@@ -161169,7 +161213,7 @@ var require_package6 = __commonJS({
161169
161213
  "package.json"(exports2, module2) {
161170
161214
  module2.exports = {
161171
161215
  name: "@sentry/craft",
161172
- version: "2.27.1",
161216
+ version: "2.28.0",
161173
161217
  description: "The universal sentry workflow CLI",
161174
161218
  main: "dist/craft",
161175
161219
  repository: "https://github.com/getsentry/craft",
@@ -161348,7 +161392,7 @@ function getPackage() {
161348
161392
  }
161349
161393
  function getPackageVersion() {
161350
161394
  const { version: version2 } = getPackage();
161351
- const buildInfo = "e0c36c1d8c07f42082e1033b56a43c9b1f8dbe01";
161395
+ const buildInfo = "aeb16753a1764f3ef0768c03c499e3d2e4b7227c";
161352
161396
  return buildInfo ? `${version2} (${buildInfo})` : version2;
161353
161397
  }
161354
161398
  function semVerToString(s6) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/craft",
3
- "version": "2.27.1",
3
+ "version": "2.28.0",
4
4
  "description": "The universal sentry workflow CLI",
5
5
  "main": "dist/craft",
6
6
  "repository": "https://github.com/getsentry/craft",