firebase / firebase/firebase-ios-sdk

[FR]: Ability to remove emulator from a functions instance

Open
#15,925 3 comments 0 reactions 0 assignees View on GitHub
api: functions type: feature request
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description

1. During development of firebase functions, I want to use the emulator if I've spun it up locally, and I want to use the deployed version if it's not running. I create the `Functions` and associate with an emulator first and check a basic function call succeeds. If not, I make a new one, "without" an emulator.
2. The SDK currently can't tell the difference between an instance with an emulator and without, and when "allocating" a new `Functions` it just does an app/region match, so returns the previous `Functions` with the emulator still associated.
I cannot remove the old emulator association (to reverse `useEmulator()`)
I cannot remove the old instance to create a clean one.

3. a) Provide emulator params when construction functions, and make this a core part of distinguishing between different `Functions` instances.
b) Allow me to destroy my `Functions` instance once I'm done with it (seems like a sensible thing to add anyway :)
c) Allow me to remove the emulator association on an existing instance (hacky!)

### API Proposal

```
class Functions ....
{
@objc open func removeEmulator() {
emulatorOrigin = nil
}
}
```

### Firebase Product(s)

Functions

Contributor guide

Open the contributing guide

Research direction

Start by tracing Functions construction and allocation by app/region, then inspect the existing useEmulator() association. Compare the proposed construction parameters, instance destruction, and removeEmulator() API before choosing a direction. Done means an instance can reliably switch between emulator and deployed Functions behavior without returning a stale emulator-associated instance.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
api, mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.