Skip to content

Cannot deploy if the functions project has a dependency (even unused) that requires build hooks #201

@alextekartik

Description

@alextekartik

Related issues

This is related to dart compile failing in such scenario. Maybe this issue should belong to the firebase tools project, sorry if that is indeed the case.
Releated issues:

Version info

Dart SDK: dart 3.12
firebase_functions: 0.6.0
firebase cli: 15.19

Test case

Simply add a dependency (even as a transitive dependency) that requires build_hooks (such as sqlite3)

Steps to reproduce

  • Generate a project using firebase init functions
  • Add sqlite3 as a dependency
  • Call firebase deploy: firebase deploy --only functions

Expected behavior

It should deploy

Actual behavior

i  functions: compiling Dart to linux-x64 executable...

Error: Dart compilation failed with exit code 255. Make sure your Dart project compiles successfully with: dart compile exe bin/server.dart --target-os=linux --target-arch=x64

And indeed:

$ dart compile exe bin/server.dart --target-os=linux --target-arch=x64
'dart compile' does not support build hooks, use 'dart build' instead.
Packages with build hooks: sqlite3.

Were you able to successfully deploy your functions?

No and I could not find any workaround as in my case sqlite3 is added by a transitive dependency...
It seems that the check for hook is only made for binaries in the bin folder but unfortunately: Firebase Functions for Dart expects your main function in bin/server.dart.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions