Skip to content

feat: warn about ignored inputs and remove misleading defaults#74

Open
JamBalaya56562 wants to merge 1 commit intoaws-actions:mainfrom
JamBalaya56562:pr74
Open

feat: warn about ignored inputs and remove misleading defaults#74
JamBalaya56562 wants to merge 1 commit intoaws-actions:mainfrom
JamBalaya56562:pr74

Conversation

@JamBalaya56562
Copy link
Copy Markdown
Contributor

When deploying with package-type: Image, several Zip-only inputs
(runtime, handler, layers) are silently dropped: index.js gates
each of them with packageType === 'Zip' && ... before sending the
CreateFunction / UpdateFunctionConfiguration request. Today the action
neither warns about the dropped values nor stops echoing the action's
own defaults into the workflow log, so the user has no signal that
their runtime: nodejs20.x (etc.) has no effect on the deployed
container function.

This is the same shape of footgun the action already guards against
for s3-bucket / s3-key / source-kms-key-arn on the Image side
and for image-uri / code-artifacts-dir on the Zip side — those
inputs already produce explicit core.warning(...) lines. This commit
extends the same treatment to the remaining Zip-only / Image-only
inputs.

Changes:

  • validations.js: in checkInputConflicts, emit a warning when
    handler, runtime, or layers is supplied with
    package-type: Image, and when image-config is supplied with
    package-type: Zip. Each warning explains why the input is being
    ignored.

  • action.yml: remove default: 'index.handler' from handler and
    default: 'nodejs20.x' from runtime. These defaults are
    injected into every action invocation by GitHub Actions and end
    up echoed in the with: block of the run log, even when the
    user did not write them — which is the exact source of confusion
    reported by users seeing runtime: nodejs20.x in their Image
    deploy logs (where it has no effect). The Zip fallback behavior
    is preserved by validations.js, which already falls back to
    'index.handler' and 'nodejs20.x' when the input is empty —
    so existing Zip users that omit either input keep getting the
    same Lambda runtime/handler. The default values are now
    documented in the input descriptions instead.

Tests:

  • Three new cases under tests/validations.test.js
    Input Conflict Warnings:
    • warns about handler/runtime/layers for Image
    • does not warn when those inputs are omitted on Image
    • warns about image-config for Zip

dist/index.js is rebuilt with npm run build (ncc 0.36.1) since
validations.js is bundled into it.

When deploying with `package-type: Image`, several Zip-only inputs
(`runtime`, `handler`, `layers`) are silently dropped: index.js gates
each of them with `packageType === 'Zip' && ...` before sending the
CreateFunction / UpdateFunctionConfiguration request. Today the action
neither warns about the dropped values nor stops echoing the action's
own defaults into the workflow log, so the user has no signal that
their `runtime: nodejs20.x` (etc.) has no effect on the deployed
container function.

This is the same shape of footgun the action already guards against
for `s3-bucket` / `s3-key` / `source-kms-key-arn` on the Image side
and for `image-uri` / `code-artifacts-dir` on the Zip side — those
inputs already produce explicit `core.warning(...)` lines. This commit
extends the same treatment to the remaining Zip-only / Image-only
inputs.

Changes:

  - validations.js: in checkInputConflicts, emit a warning when
    `handler`, `runtime`, or `layers` is supplied with
    package-type: Image, and when `image-config` is supplied with
    package-type: Zip. Each warning explains why the input is being
    ignored.

  - action.yml: remove `default: 'index.handler'` from `handler` and
    `default: 'nodejs20.x'` from `runtime`. These defaults are
    injected into every action invocation by GitHub Actions and end
    up echoed in the `with:` block of the run log, even when the
    user did not write them — which is the exact source of confusion
    reported by users seeing `runtime: nodejs20.x` in their Image
    deploy logs (where it has no effect). The Zip fallback behavior
    is preserved by validations.js, which already falls back to
    `'index.handler'` and `'nodejs20.x'` when the input is empty —
    so existing Zip users that omit either input keep getting the
    same Lambda runtime/handler. The default values are now
    documented in the input descriptions instead.

Tests:

  - Three new cases under __tests__/validations.test.js
    `Input Conflict Warnings`:
      * warns about handler/runtime/layers for Image
      * does not warn when those inputs are omitted on Image
      * warns about image-config for Zip

dist/index.js is rebuilt with `npm run build` (ncc 0.36.1) since
validations.js is bundled into it.
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.

1 participant