@faable/faable 1.15.2 → 1.15.3

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.
@@ -8,7 +8,7 @@ import { check_environment } from './check_environment.js';
8
8
  import { git_context } from './git_context.js';
9
9
  import { resolve_app_id } from './resolve_app_id.js';
10
10
  import { secrets } from './secrets/index.js';
11
- import { start_log_sync, mark_build_failure, upload_logs } from './upload_logs.js';
11
+ import { mark_build_failure, start_log_sync, upload_logs } from './upload_logs.js';
12
12
  import { upload_tag } from './upload_tag.js';
13
13
 
14
14
  const deploy = {
@@ -41,20 +41,43 @@ const deploy = {
41
41
  const workdir = args.workdir || process.cwd();
42
42
  const ctx = await requireApi();
43
43
  const { api } = ctx;
44
- // Resolve the buildpack plan (detection or forced override). All the
45
- // build thinking happens here; build() below just executes the plan.
46
44
  const config = Configuration.instance().deployConfig();
47
- const plan = await detect_buildpack({ workdir, config }, args.buildpack || config.buildpack);
48
45
  const app_id = await resolve_app_id(args.app_id, ctx.appId, api, workdir);
49
46
  const app = await api.getApp(app_id);
50
47
  // Capture the commit/ref/actor so the deployment records which commit
51
48
  // it came from and who pushed it (env in CI, git fallback locally).
52
49
  const git = await git_context({ workdir });
50
+ // Resolve the buildpack plan (detection or forced override). All the build
51
+ // thinking happens here; build() below just executes the plan. Detection can
52
+ // fail (e.g. an app whose start command can't be inferred) — and it runs
53
+ // before the create-first deployment exists, so without this a detection
54
+ // failure would leave NO deployment row: no deploy-failed email, nothing in
55
+ // the dashboard, just a red X in the CI logs the user may never see. Record
56
+ // it as a failed deployment instead.
57
+ let plan;
58
+ try {
59
+ plan = await detect_buildpack({ workdir, config }, args.buildpack || config.buildpack);
60
+ }
61
+ catch (error) {
62
+ // Log the reason into the build buffer first (so it rides along in the
63
+ // attached logs), then record a typeless BUILD_ERROR row — typeless so it
64
+ // can't rewrite the app's runtime_strategy. Best-effort: a create that
65
+ // itself fails (e.g. the free-plan quota gate) must not mask the original
66
+ // detection error.
67
+ log.error(error.message);
68
+ const failed = await api
69
+ .createDeployment({ app_id: app.id, ...git })
70
+ .catch(() => null);
71
+ if (failed) {
72
+ await mark_build_failure(api, { deployment_id: failed.id, app });
73
+ }
74
+ throw error;
75
+ }
53
76
  // Create-first: register the deployment BEFORE building. Gate rejections
54
77
  // (free-plan quota 429, disabled app 409) surface here, at second 0 —
55
78
  // before any build minutes are spent. The row is born QUEUED; the CLI
56
79
  // owns it until the built image lands (or the build fails). `type` rides
57
- // on the create as before — the buildpack plan is already resolved.
80
+ // on the create — the buildpack plan is already resolved.
58
81
  const deployment = await api.createDeployment({
59
82
  app_id: app.id,
60
83
  type: plan.type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/faable",
3
- "version": "1.15.2",
3
+ "version": "1.15.3",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Marc Pomar <marc@faable.com>",