Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edge build supabase_functions doesn't compile anything. #24

Closed
gaetschwartz opened this issue Apr 17, 2023 · 5 comments
Closed

edge build supabase_functions doesn't compile anything. #24

gaetschwartz opened this issue Apr 17, 2023 · 5 comments
Assignees

Comments

@gaetschwartz
Copy link
Contributor

gaetschwartz commented Apr 17, 2023

The runBuild method is empty. I'm not sure but shouldn't it be something like

 Future<void> runBuild() async {
    final functionDirectory = Directory(
      p.join(Directory.current.path, 'supabase', 'functions', 'dart_edge'),
    );

    final compiler = Compiler(
      logger: logger,
      entryPoint: p.join(Directory.current.path, 'lib', 'main.dart'),
      outputDirectory: functionDirectory.path,
      outputFileName: 'main.dart.js',
      level: CompilerLevel.O1,
    );

    await compiler.compile();
}
@Ehesp
Copy link
Member

Ehesp commented Apr 18, 2023

Oh, woops!

Yes it should be:

  Future<void> runBuild() async {
    final functionDirectory = Directory(
      p.join(Directory.current.path, 'supabase', 'functions', 'dart_edge'),
    );

    final entryFile = File(p.join(functionDirectory.path, 'index.ts'));

    final compiler = Compiler(
      logger: logger,
      entryPoint: p.join(Directory.current.path, 'lib', 'main.dart'),
      outputDirectory: functionDirectory.path,
      outputFileName: 'main.dart.js',
      level: CompilerLevel.O4,
    );

    await compiler.compile();

    await entryFile.writeAsString(
      edgeFunctionEntryFileDefaultValue('main.dart.js'),
    );
  }

Feel free to PR - or I'll get around to it soon.

@Ehesp
Copy link
Member

Ehesp commented Apr 18, 2023

Also the dev build will still work for now in prod, it's just less optimised.

@gaetschwartz
Copy link
Contributor Author

Feel free to PR - or I'll get around to it soon.

Working on a PR along a few other improvements :)

@Ehesp
Copy link
Member

Ehesp commented May 2, 2023

Quickly fixed this in a standalone PR: c9c0fe3

@Ehesp Ehesp closed this as completed May 2, 2023
@solid-danylokhvan
Copy link

solid-danylokhvan commented May 2, 2023

Because every version of supabase_functions from git depends on edge from hosted and supabase_edge_functions depends on edge from git, supabase_functions from git is forbidden.
So, because supabase_edge_functions depends on supabase_functions from git, version solving failed.

When I'm trying to get supabase_functions 0.0.2+2 to fix building the supabase functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants