smartcontractkit / smartcontractkit/cre-sdk-typescript

getSecret() error message reports "namespace: default" when actual request uses "namespace: main"

Open Beginner friendly
#312 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
6
Forks
9
Avg merge
5h 23m
Merged PRs (30d)
6

Description

Environment

  • SDK version: @chainlink/cre-sdk 1.18.0
  • File: dist/sdk/impl/runtime-impl.js

Bug

The error message for a failed getSecret() call reports the wrong namespace,
making diagnosis much harder.

In runtime-impl.js:

// Line 8: correct default
const DEFAULT_SECRET_NAMESPACE = 'main';

// Line 263: correct — 'main' goes on the wire
namespace: request.namespace || DEFAULT_SECRET_NAMESPACE

// Line 318: bug — un-normalized object passed to error constructor
throw new SecretsError(secretRequest, err.error);

In errors.js line ~19:

`... (namespace: ${secretRequest.namespace || 'default'}) ...`

The secretRequest passed to SecretsError is the un-normalized object
(namespace = ""), while the actual wire request used 'main'. The error
formatter then falls back to the literal string 'default', which is neither
the requested namespace nor the SDK default.

Impact

Developers see namespace: default in the error and spend significant time
chasing a namespace mismatch that doesn't exist. The actual failure reason
(relay quorum) is buried after the misleading namespace string.

Fix

In getSecrets() or getSecret(), normalize the request object before
passing it to SecretsError, or use DEFAULT_SECRET_NAMESPACE as the
fallback in the error formatter instead of the literal 'default'.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in dist/sdk/impl/runtime-impl.js around getSecrets()/getSecret() and inspect errors.js around the SecretsError formatter. Reproduce a failed request with an empty namespace and compare the wire namespace with the error text. Done means the error reports the effective namespace, main, rather than default, while preserving the relay failure reason.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.