Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ fixed - Fixes issue where headers and response codes for HTTP functions were los
fixed - Fixes issue where firebase serve does not properly start the Functions emulator.
fixed - Adds a devDependency on firebase-functions-test to the default functions init template to prevent emulator issues.
fixed - Fixes issue where the Firestore + RTDB emulators were starting on ports 5002/3 instead of 8080/9000
fixed - Adds a log message when emulators have successfully started.
fixed - Adds a log message when emulators have successfully started.
fixed - Disable some advanced Functions emulator features when run through "firebase serve".
4 changes: 4 additions & 0 deletions src/emulator/functionsEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
EmulatedTriggerDefinition,
EmulatedTriggerMap,
FunctionsRuntimeBundle,
FunctionsRuntimeFeatures,
getFunctionRegion,
getTriggersFromDirectory,
} from "./functionsEmulatorShared";
Expand All @@ -34,6 +35,7 @@ const SERVICE_FIRESTORE = "firestore.googleapis.com";
interface FunctionsEmulatorArgs {
port?: number;
host?: string;
disabledRuntimeFeatures?: FunctionsRuntimeFeatures;
}

interface RequestWithRawBody extends express.Request {
Expand Down Expand Up @@ -256,6 +258,7 @@ export class FunctionsEmulator implements EmulatorInstance {
cwd: this.functionsDir,
triggerId: triggerName,
projectId: this.projectId,
disabled_features: this.args.disabledRuntimeFeatures,
};

const runtime = InvokeRuntime(this.nodeBinary, runtimeBundle);
Expand Down Expand Up @@ -380,6 +383,7 @@ You can probably fix this by running "npm install ${
projectId: this.projectId,
triggerId: "",
ports: {},
disabled_features: this.args.disabledRuntimeFeatures,
};

// TODO(abehaskins): Gracefully handle removal of deleted function definitions
Expand Down
6 changes: 6 additions & 0 deletions src/emulator/functionsEmulatorRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,12 @@ async function main(): Promise<void> {
}).log();
}

new EmulatorLog(
"DEBUG",
"runtime-status",
`Disabled runtime features: ${JSON.stringify(frb.disabled_features)}`
).log();

const verified = verifyDeveloperNodeModules(frb.cwd);
if (!verified) {
// If we can't verify the node modules, then just leave, soemthing bad will happen during runtime.
Expand Down
14 changes: 13 additions & 1 deletion src/serve/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ module.exports = {
emulatorServer: undefined,

async start(options: any): Promise<void> {
this.emulatorServer = new EmulatorServer(new FunctionsEmulator(options, {}));
this.emulatorServer = new EmulatorServer(
new FunctionsEmulator(options, {
// When running the functions emulator through 'firebase serve' we disable some
// of the more adventurous features that could be breaking/unexpected behavior
// for those used to the legacy emulator.
disabledRuntimeFeatures: {
functions_config_helper: true,
network_filtering: true,
timeout: true,
memory_limiting: true,
},
})
);
await this.emulatorServer.start();
},

Expand Down