Skip to content

fix: secrete manager may return undefined#45

Merged
takumiyoshikawa merged 2 commits into
mainfrom
fix/secret-manager-type-incompatibility
Jun 25, 2025
Merged

fix: secrete manager may return undefined#45
takumiyoshikawa merged 2 commits into
mainfrom
fix/secret-manager-type-incompatibility

Conversation

@takumiyoshikawa
Copy link
Copy Markdown
Contributor

In this PR, I'm improving the typing of the secret manager within the function service.

Below is an actual execution log from the vault on the Tailor platform. As shown, getSecret can potentially return undefined.
Also, since getSecrets takes an object with the vault key names as arguments, we can narrow the type accordingly. In terms of behavior, if a non-existent key is specified, the key will not be included in the response object. Therefore, the keys in the response of getSecrets should be treated as optional.

[Execution Logs]
2025-06-24 09:05:37.955922 +0000 UTC STARTED
2025-06-24T09:05:38.117075074Z INFO === getSecrets() behavior ===
2025-06-24T09:05:38.117334445Z INFO Result object: [Object: null prototype] { "existing-key": "this-is-the-secret-value" }
2025-06-24T09:05:38.117350195Z INFO 
2025-06-24T09:05:38.117369795Z INFO 'existing-key' in result: true
2025-06-24T09:05:38.117386855Z INFO 'non-existing-key' in result: false
2025-06-24T09:05:38.117392625Z INFO 
2025-06-24T09:05:38.117400715Z INFO secrets['existing-key']: this-is-the-secret-value
2025-06-24T09:05:38.117414705Z INFO secrets['non-existing-key']: undefined
2025-06-24T09:05:38.117422015Z INFO 
=== getSecret() behavior ===
2025-06-24T09:05:38.371347878Z INFO getSecret('existing-key'): this-is-the-secret-value
2025-06-24T09:05:38.371386039Z INFO getSecret('non-existing-key'): undefined
2025-06-24 09:05:38.371439 +0000 UTC FINISHED

@takumiyoshikawa takumiyoshikawa requested a review from a team as a code owner June 24, 2025 09:50
@takumiyoshikawa takumiyoshikawa force-pushed the fix/secret-manager-type-incompatibility branch from eabe20d to 6d90c53 Compare June 24, 2025 09:52
Copy link
Copy Markdown
Contributor

@mocchira mocchira left a comment

Choose a reason for hiding this comment

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

LGTM

@takumiyoshikawa takumiyoshikawa merged commit fa4134d into main Jun 25, 2025
6 checks passed
@takumiyoshikawa takumiyoshikawa deleted the fix/secret-manager-type-incompatibility branch June 25, 2025 02:31
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