Skip to content

SecretParam and other param types not exported from firebase-functions/params in v7.0.0 #1777

@unxavi

Description

@unxavi

[REQUIRED] Version info

node: v22.20.0

firebase-functions: 7.0.0

firebase-tools: 14.1.0

firebase-admin: 13.1.0

[REQUIRED] Test case

// authMiddleware.ts
import { https } from "firebase-functions";
import type { SecretParam } from "firebase-functions/params";

export const authenticatedFunction = (
  secrets: (string | SecretParam)[],
  handler: (request: https.CallableRequest, userId: string) => Promise<any>,
) => {
  return https.onCall({ secrets: secrets }, async (request) => {
    if (\!request.auth) {
      throw new https.HttpsError("failed-precondition", "Must be authenticated.");
    }
    return handler(request, request.auth.uid);
  });
};

[REQUIRED] Steps to reproduce

  1. Upgrade from firebase-functions 6.x to 7.0.0
  2. Attempt to import SecretParam type: import type { SecretParam } from "firebase-functions/params"
  3. Run TypeScript compiler

[REQUIRED] Expected behavior

The SecretParam type should be importable from firebase-functions/params since:

  • It's defined and exported in lib/params/types.d.ts
  • It's used as the return type of the exported defineSecret() function
  • Similar param types (StringParam, BooleanParam, etc.) should also be available for type annotations

[REQUIRED] Actual behavior

TypeScript compilation fails with:

error TS2459: Module '"firebase-functions/params"' declares 'SecretParam' locally, but it is not exported.

Root cause:
Looking at lib/params/index.d.ts, the type is imported internally:

import { BooleanParam, Expression, IntParam, Param, ParamOptions, SecretParam, JsonSecretParam, StringParam, ListParam } from "./types";

But it's never re-exported. The file only exports:

export { BUCKET_PICKER, select, multiSelect } from "./types";
export type { TextInput, SelectInput, SelectOptions, MultiSelectInput } from "./types";
export { Expression };
export type { ParamOptions };

Workaround:
Use TypeScript's ReturnType utility:

import type { params } from "firebase-functions";
type SecretParam = ReturnType<typeof params.defineSecret>;

Were you able to successfully deploy your functions?

Yes, deployment works fine. This is purely a TypeScript type annotation issue that doesn't affect runtime behavior, only developer experience when trying to type function parameters that accept secrets.


Suggested fix:
Add the following to lib/params/index.d.ts:

export type { SecretParam, JsonSecretParam, StringParam, BooleanParam, IntParam, ListParam } from "./types";

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions