Skip to content

[cloud functions for dart] Allow functions in a folder different than "bin" to workaround build hook issues #10591

@alextekartik

Description

@alextekartik

See: (https://github.com/firebase/firebase-functions-dart/issues/201)](https://github.com/firebase/firebase-functions-dart/issues/201)

Sorry for the cross posting here but I think the issue belongs to here...

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.

Looking at https://github.com/dart-lang/sdk/blob/80f770eb5752322a320b003b45dc79b9e14a5fba/pkg/dartdev/lib/src/commands/compile.dart#L742-L759
We cannot bypass this check and force dart compile to work as the "bin" folder is a hardcoded required.

Solutions

  • Allow configuring the dart entry point (pubspec.yaml?)
  • Look in multiple locations, not just the bin folder
  • Use dart build instead of dart compile

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