Skip to content

Realtime instance can not be configured using params for onValueWritten functions #1613

Open
@pitazzo

Description

@pitazzo

Version info

node: v20.10.0

firebase-functions: ^5.1.1

firebase-tools: 13.16.0

firebase-admin: ^12.4.0

Test case

Setup a Firebase Cloud Function with the following code:

exports.foo = onValueWritten(
  {
    ref: '/foo/bar,
    instance: defineString('REALTIME_INSTANCE'),
  },
  async (change) => {
    console.log('hey!);
  },
);

Steps to reproduce

Try to compile following the example code, npm run build.

Expected behavior

We should be able to deploy functions with Realtime instance as a parameter. This is very needed in projects with different Realtime instance per environment. For example, we have to different Realtime instances, one for production and another for staging, and we want to have our functions deployed twice, once per instance.

Actual behavior

As the ReferenceOptions<Ref> object only accepts string as type for the instance value, it's impossible to configure it based on the environment.

Were you able to successfully deploy your functions?

No, as it's impossible to build the codebase.

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