firebase-admin-node
firebase-admin-node copied to clipboard
SecretParam TS type is not exported
Describe your environment
- Operating System version: Mac Sonoma 14.3
- Firebase SDK version: v12.0.0
- Firebase Product: Admin SDK for NodeJS
- Node.js version: v18.17.1
- NPM version: 9.8.1
- VSCode version: 1.85.2
- ESLint version: 8.56.0
- @typescript-eslint/eslint-plugin version: 6.20.0
Describe the problem
Using VSCode with ESLint & TypeScript enabled, I am trying to write a function that takes the results of defineSecret() and does some processing on it to reduce code duplication across my project. The issue is that the datatype returned, SecretParam, is not exported.
When trying:
import {SecretParam} from 'firebase-functions/params';
VSCode reports:
Module '"firebase-functions/params"' declares 'SecretParam' locally, but it is not exported.ts(2459)
index.d.ts(5, 67): 'SecretParam' is declared here.
TSC errors out with:
error TS2459: Module '"firebase-functions/params"' declares 'SecretParam' locally, but it is not exported.
Relevant Code:
The code below is throwing ESLint errors and fails to compile with tsc:
import {SecretParam} from 'firebase-functions/params';
export const safeGetConfigJsonVal = (secretKey: SecretParam): Record<string, any> => {
if (!secretKey.value()) {
throw new Error('secretKey.value() is null/undefined');
}
let myConfig;
try {
myConfig = JSON.parse(secretKey.value());
return myConfig;
} catch (ex) {
throw new Error(
`secretKey is not a valid JSON string: ${secretKey.value()}`
);
}
};
Workaround:
Put // @ts-ignore on the line immediately before the import line
I found a few problems with this issue:
- I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
- This issue does not seem to follow the issue template. Make sure you provide all the required information.
Looks like the issue may have been addressed in the functions SDK https://github.com/firebase/firebase-functions/blob/9c818713db511895a33378859ab1b9f2eef99179/src/params/types.ts#L429
If you are still experiencing this issue please open a new ticket on the https://github.com/firebase/firebase-functions/tree/master repo.