Skip to content

fix(bb-app-setting): throw ParameterNotFound for missing parameters on AWS - #1142

Merged
xyos merged 1 commit into
aws:mainfrom
xyos:fix/bb-app-setting-aws-parameter-not-found
Nov 6, 2026
Merged

xyos merged 1 commit into
aws:mainfrom
xyos:fix/bb-app-setting-aws-parameter-not-found

Conversation

@xyos

@xyos xyos commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Problem

The README and packages/bb-app-setting/src/types.ts document that AppSetting.get() throws AppSettingErrors.ParameterNotFound when the parameter is missing. On AWS, get() in packages/bb-app-setting/src/index.aws.ts sent GetParameterCommand without catching anything, so a missing parameter (for example, one deleted out-of-band) surfaced as the SDK's raw ParameterNotFound exception. isBlocksError(e, AppSettingErrors.ParameterNotFound) was false, and because the error is not branded it crossed RPC as a generic 500 with no name.

Issue #, if available:

Changes

  • packages/bb-app-setting/src/index.aws.ts: get() catches the SDK ParameterNotFound (by instanceof, falling back to the error name) and throws the branded AppSettingErrors.ParameterNotFound. Other errors are rethrown unchanged. fromExisting() settings use the same get().
  • packages/bb-app-setting/src/index.aws.test.ts: tests for the mapping (branded and wire-safe) and for pass-through of other SDK errors.
  • .changeset/app-setting-aws-parameter-not-found.md: patch for @aws-blocks/bb-app-setting.

Validation

  • New test maps the SDK ParameterNotFound to a branded AppSettingErrors.ParameterNotFound failed before the fix (AssertionError: got ParameterNotFound) and passes after.
  • npm run build, @aws-blocks/bb-app-setting npm test, npm run lint, npm run lint:deps: pass.
  • npm test (all workspaces) and npm run test:e2e:local from the repo root: pass.

Checklist

  • PR description included
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@xyos
xyos requested a review from a team as a code owner October 29, 2026 22:01
@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3180892

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-blocks/bb-app-setting Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@belaboe belaboe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This closes a real gap between the docs and the behavior, and the mapping looks right: branded, no enumerable cause, and other SDK errors still pass through. A few non-blocking notes:

  1. Now that the error is branded, its message goes over RPC. AuthBasic, for example, shows it to anonymous callers, so the SSM path (including a fromExisting name like /prod/db/...) is visible where clients used to see Internal error. Could the message use this.fullId, as bb-secret does, or a fixed string?
  2. Could you keep the SDK error as a non-enumerable cause, like kv-store and knowledge-base do, so the requestId survives in server logs?
  3. Changeset: maybe add a line for anyone who matched e.name === 'ParameterNotFound', pointing them to isBlocksError(e, AppSettingErrors.ParameterNotFound).
  4. Nits: the get() JSDoc still says "guaranteed to exist", so it needs a fromExisting/out-of-band caveat. Line 148 still calls getSdkIdentifiers(). A name-only test case would cover the fallback branch.

@xyos
xyos merged commit e83d152 into aws:main Nov 6, 2026
42 checks passed
harsh62 added a commit that referenced this pull request Nov 6, 2026
Brings in 14 commits from main, among them "fix(core): return Invalid
Request for a null JSON-RPC body" (#1143), "fix(core): reject non-JSON-RPC
response bodies with ApiError" (#1171), "feat(bb-logger,core): backend Lambda
log lines carry the invocation's requestId" (#1325), #1131, #1132, #1142,
#1167, #1173, #1178, #1214, #494 and CI changes (#946, #970, #971).

packages/core/src/client/index.test.ts and lambda-handler.test.ts: keep both
sides' tests (this branch's httpErrorStatus, namespace identity and per-call
fetch suites; main's non-JSON-RPC body and request id suites).

packages/core/src/api.ts: the httpErrorStatus docs now say what the client
does since #1171 when a Hosting error page replaces a 403 / 404: it rejects
with a bare ApiError carrying the HTTP status, instead of response.json()
throwing.

# Conflicts:
#	packages/core/src/client/index.test.ts
#	packages/core/src/lambda-handler.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants