Skip to content

Bun Compatibility Support #1824

@rossano-montori-elp

Description

@rossano-montori-elp

Related issues

While there are discussions in the community regarding Bun compatibility (such as oven-sh/bun#8549), there does not appear to be an official tracking issue in firebase-functions for native Bun runtime support for Gen 1/2 Cloud Functions and the local emulator suite.

[REQUIRED] Test case

A package.json for a project attempting to declare Bun as the primary engine:

{
  "scripts": {
    "build": "bun run build:ts",
    "build:ts": "tsc",
    "serve": "firebase emulators:start --only functions",
    "deploy": "firebase deploy --only functions"
  },
  "engines": {
    "bun": "1.x"
  },
  "main": "lib/index.js",
  "dependencies": {
    "firebase-admin": "...",
    "firebase-functions": "..."
  },
  "devDependencies": {
    "typescript": "..."
  }
}

[REQUIRED] Expected behavior

Local Emulator: The emulator suite should respect the declared package manager and runtime environment, executing the function code natively via Bun. This would allow for native TypeScript execution without strictly requiring a tsc build step, alongside significantly faster startup times. Currently, the emulator defaults to spinning up a Node.js process.

Deployment: The Firebase CLI should recognize bun as a valid runtime engine for functions. Because Gen 2 functions are built on top of Cloud Run, the CLI should seamlessly package the function into a container equipped with Bun.

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