-
Notifications
You must be signed in to change notification settings - Fork 213
Description
Related issues
Kind of related: #5277
Related StackOverflow question: https://stackoverflow.com/q/74744707/2774496
[REQUIRED] Version info
node: v18.13.0
firebase-functions: 4.1.1
firebase-tools: 11.20.0
firebase-admin: 11.5.0
[REQUIRED] Test case
import { Options } from '@mikro-orm/core';
import { defineString } from 'firebase-functions/params';
const config = {
...
dbName: defineString('DB_NAME').value(),
...
} as Options;
export default config;
[REQUIRED] Steps to reproduce
- Use the above code and start the emulator
- See the following warning in console:
{"severity":"WARNING","message":"params.DB_NAME.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() }"}
If I remove .value
to keep config
as:
const config = {
...
dbName: defineString('DB_NAME'),
...
} as Options;
I get the following Typescript error:
Types of property 'dbName' are incompatible.
Type 'StringParam' is not comparable to type 'string'.
[REQUIRED] Expected behavior
If using .value()
is not supported during functions development, we should be able to use the variable without .value()
without any errors from Typescript.
If using .value()
is working anyway during function development, no warning should be displayed.
[REQUIRED] Actual behavior
To be able to serve functions using Typescript, we need to use .value()
with parameterized configurations. Unfortunately, it logs a lot of unnecessary warning to the console. But without .value()
, we have Typescript errors preventing serving the app.