@deployfoundation/foundation-deploy 0.1.2 → 0.1.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.
@@ -422,6 +422,10 @@ async function ensureEndpoint(runner, opts) {
422
422
  return "created";
423
423
  }
424
424
  async function promoteEndpoint(runner, opts) {
425
+ if (opts.dryRun !== true && await endpointState(runner, opts.id, opts.name) === undefined) {
426
+ await ensureEndpoint(runner, opts);
427
+ return;
428
+ }
425
429
  await runner.mutate([
426
430
  "bedrock-agentcore-control",
427
431
  "update-agent-runtime-endpoint",
@@ -1837,6 +1841,15 @@ ${USAGE}`);
1837
1841
  }
1838
1842
  if (command === "slack-manifest") {
1839
1843
  const paths = loadInstanceContext(resolveInstanceFilePath(args, process.env));
1844
+ if (process.env.EVENTS_REQUEST_URL === undefined)
1845
+ console.error([
1846
+ "warning: EVENTS_REQUEST_URL is not set, so this manifest has NO event",
1847
+ "subscriptions, slash commands or interactivity. Applying it to an existing",
1848
+ "app removes them. Set EVENTS_REQUEST_URL to the <Prefix>Api stack's EventsUrl",
1849
+ "output (commands and interactivity are derived from it) unless you are",
1850
+ "creating the app for the first time."
1851
+ ].join(`
1852
+ `));
1840
1853
  console.log(JSON.stringify(slackManifestFor(paths.instance, {
1841
1854
  ...process.env.EVENTS_REQUEST_URL === undefined ? {} : { EVENTS_REQUEST_URL: process.env.EVENTS_REQUEST_URL },
1842
1855
  ...process.env.COMMANDS_REQUEST_URL === undefined ? {} : { COMMANDS_REQUEST_URL: process.env.COMMANDS_REQUEST_URL },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deployfoundation/foundation-deploy",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Deploys one Foundation instance from a published, signed release: the CDK app and the deploy tool.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
package/src/deploy/cli.ts CHANGED
@@ -116,6 +116,20 @@ export async function main(argv: readonly string[] = process.argv.slice(2)): Pro
116
116
  // print a banner into it; every other command announces its target first.
117
117
  if (command === "slack-manifest") {
118
118
  const paths = loadInstanceContext(resolveInstanceFilePath(args, process.env));
119
+ // Without the request URLs the manifest omits event subscriptions, slash
120
+ // commands and interactivity. That is right for creating a brand-new app,
121
+ // and destructive for an existing one: applying it strips the app's
122
+ // wiring. Say so on stderr, so stdout stays a clean manifest.
123
+ if (process.env.EVENTS_REQUEST_URL === undefined)
124
+ console.error(
125
+ [
126
+ "warning: EVENTS_REQUEST_URL is not set, so this manifest has NO event",
127
+ "subscriptions, slash commands or interactivity. Applying it to an existing",
128
+ "app removes them. Set EVENTS_REQUEST_URL to the <Prefix>Api stack's EventsUrl",
129
+ "output (commands and interactivity are derived from it) unless you are",
130
+ "creating the app for the first time.",
131
+ ].join("\n"),
132
+ );
119
133
  console.log(
120
134
  JSON.stringify(
121
135
  slackManifestFor(paths.instance, {
@@ -140,11 +140,25 @@ export async function ensureEndpoint(
140
140
  return "created";
141
141
  }
142
142
 
143
- /** Point an existing endpoint at `version` and wait for it to be READY there. */
143
+ /**
144
+ * Point the endpoint at `version` and wait for it to be READY there, creating
145
+ * it at that version when it does not exist yet.
146
+ *
147
+ * Only `setup` used to create `live`; `deploy` and `post-deploy` could only
148
+ * update it. An instance brought up the documented way, `foundation-deploy
149
+ * deploy` from npm, therefore reached promotion with no `live` to update, and
150
+ * the gateway's invoker, which calls `live`, had nothing to call: the first
151
+ * Slack message after a fresh install would have failed. Found by migrating
152
+ * Olivia.
153
+ */
144
154
  export async function promoteEndpoint(
145
155
  runner: EndpointRunner,
146
156
  opts: EndpointOptions,
147
157
  ): Promise<void> {
158
+ if (opts.dryRun !== true && (await endpointState(runner, opts.id, opts.name)) === undefined) {
159
+ await ensureEndpoint(runner, opts);
160
+ return;
161
+ }
148
162
  await runner.mutate([
149
163
  "bedrock-agentcore-control",
150
164
  "update-agent-runtime-endpoint",