Skip to content

Feature: Support Named Credentials for REST log saves - #1028

Open
jcd1991 wants to merge 1 commit into
jongpie:mainfrom
jcd1991:feature/996-rest-named-credential
Open

jcd1991 wants to merge 1 commit into
jongpie:mainfrom
jcd1991:feature/996-rest-named-credential

Conversation

@jcd1991

@jcd1991 jcd1991 commented Sep 26, 2026

Copy link
Copy Markdown

PR description

Closes #996.

Related to #761 and builds on the upstream fix in #995. This change keeps the #995 behavior as the source of truth: non-REST logging no longer resolves a session ID, while REST retains the synchronous session-ID fallback for backwards compatibility. Machine-to-machine contexts can require a Named Credential explicitly.

Summary

  • Added LoggerParameter.RestApiNamedCredential and LoggerParameter.RestApiRequireNamedCredential Custom Metadata records.
  • Added Named Credential endpoint construction with optional callout: prefix normalization and no manually supplied Authorization header.
  • Added a catchable configuration error when a Named Credential is required but missing.
  • Chunked REST sObject Collections requests by Salesforce's 200-record limit, serialized request size, and remaining callout budget.
  • Removed quadratic serialization and buffer-removal behavior.
  • Validated HTTP status, JSON shape, result count, item-level success, errors, and returned IDs.
  • Defined at-least-once retry semantics for failed or ambiguous chunks.
  • Added positive, negative, malformed-response, mixed-result, retry, payload-size, callout-budget, handler-reordering, fallback, and System.UserInfo.getSessionId() throws System.UnexpectedException #761 regression tests.
  • Updated README and Apex configuration documentation.

Package and security notes

  • Named Credential, External Credential, endpoint secrets, and org-specific authentication metadata are intentionally not included in package source.
  • Subscribers must create and authorize the Named Credential in their own org.
  • The existing managed-package release pipeline should generate the managed-package source and package version after review; no package version is created by this local draft.

Test plan

  • Focused Salesforce suite: 562/562 passed.
  • Full Salesforce suite: 1,304/1,304 passed.
  • Repository-wide LWC suite: 19 suites, 336/336 passed.
  • Apex PMD scan: 0 violations.
  • Prettier verification and git diff --check: passed.
  • The local Developer Edition verified Named Credential routing with an org-only no-auth Named Credential; authenticated External Credential exchange remains a sandbox/scratch-org release verification step.

Release checklist

  • Run the repository CI scratch-org matrix and Codecov workflow.
  • Run the managed/unlocked package-version automation required by the release pipeline; no package version is created by this local draft.
  • Validate a real authenticated Named Credential/External Credential exchange in a sandbox or scratch org. The local Developer Edition test intentionally used an org-only no-auth Named Credential and verified routing, not subscriber authentication.
  • Re-run the Apex documentation generator in the CI/build environment. The local docs verifier reported the repository's known PowerShell/apexdocs symlink warning, so generated-doc freshness is not claimed as fully verified locally.

Branch

  • Base: main
  • Head: feature/996-rest-named-credential
  • Local commit: 7bdae54

@jcd1991
jcd1991 requested a review from jongpie as a code owner September 26, 2026 04:34

This branch has not been deployed

No deployments
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.

Support using a named credential for self-calling REST API endpoints in the current org

1 participant