Skip to content

Warning about using .value() whenever an expression is used in the cors option #1715

@segevfiner

Description

@segevfiner

Related issues

[REQUIRED] Version info

node: 22.17.1

firebase-functions: 6.4.0

firebase-tools: 14.11.1

firebase-admin: 13.4.0

[REQUIRED] Test case

import { onCall } from 'firebase-functions/v2/https';
import { projectID } from 'firebase-functions/params';

export const helloworld = onCall<unknown, string>(
  { cors: projectID.equals('something').thenElse(['http://localhost:5173'], []) },
  () => {
    return 'Hello from Firebase!';
  },
);

[REQUIRED] Steps to reproduce

  1. Just create a firebase-functions project and deploy the given function.

[REQUIRED] Expected behavior

Deploys cleanly without warnings.

[REQUIRED] Actual behavior

Gets a warning:

{"severity":"WARNING","message":"params.PROJECT_ID == \"something\" ? [\"http://localhost:5173\"] : [].value() invoked during function deployment, instead of during runtime."}
{"severity":"WARNING","message":"This is usually a mistake. In configs, use Params directly without calling .value()."}

{"severity":"WARNING","message":"example: { memory: memoryParam } not { memory: memoryParam.value() }"}

Despite not using .value() in my code. The .value() is inside firebase-functions own code.

Were you able to successfully deploy your functions?

Yes.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions