Skip to content

Unable to use result of defineString in runWith config #5347

Closed
@RYFN

Description

@RYFN

[REQUIRED] Environment info

firebase-tools: 11.18.0

Platform: macOS

[REQUIRED] Test case

Params docs https://firebase.google.com/docs/functions/config-env#params state

// To use configured parameters inside the config for a function, provide them
// directly. To use them at runtime, call .value() on them.

However, attempting to use this in a typescript deployment of a function;

import { defineString } from 'firebase-functions/params';
...
const vpcConnector = defineString('MY_VPC');

export const someFunction = functions
    .region('europe-west2')
    .runWith({
        vpcConnector: vpcConnector,
        vpcConnectorEgressSettings: 'ALL_TRAFFIC'
    })
    .https.onCall(async (data, context) => {
          ...

Leads to TS error Type 'StringParam' is not assignable to type 'string | ResetValue | undefined'. Type 'Param<string>' is not assignable to type 'ResetValue'.

I can vpcConnector: vpcConnector.value() but from the docs, this seems like an incorrect approach?

Screenshot 2022-12-19 at 12 17 59

[REQUIRED] Steps to reproduce

See example above.

[REQUIRED] Expected behavior

Use variables created from defineString in runtime config in TS function

[REQUIRED] Actual behavior

Types won't allow return value of defineString to be used in runtime config.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions