Skip to content

Conversation

@johnstonmatt
Copy link

@johnstonmatt johnstonmatt commented Oct 29, 2025

What kind of change does this PR introduce?

Feature DEVWF-756

What is the current behavior?

  • supabase functions download foo spins up an edge-runtime container to download the eszip bundle and writes it to the filesystem

What is the new behavior?

  • supabase functions download foo --use-api calls the mgmt-api to unbundle the eszip on the server, then returns it as a multipart response and writes it to the filesystem

Parity

We expect that whether you choose to --use-api or not you should end up with the same files on disk.

Additional context

Add any other context or screenshots.

@johnstonmatt johnstonmatt requested a review from a team as a code owner October 29, 2025 08:46
@coveralls
Copy link

coveralls commented Oct 29, 2025

Pull Request Test Coverage Report for Build 18971217678

Details

  • 43 of 124 (34.68%) changed or added relevant lines in 2 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.2%) to 54.473%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/functions.go 0 4 0.0%
internal/functions/download/download.go 43 120 35.83%
Files with Coverage Reduction New Missed Lines %
internal/functions/download/download.go 1 38.06%
internal/gen/keys/keys.go 5 12.9%
Totals Coverage Status
Change from base Build 18965934599: -0.2%
Covered Lines: 6430
Relevant Lines: 11804

💛 - Coveralls

}

// Create the full path for the file
filePath := filepath.Join(funcDir, relPath)
Copy link
Contributor

@sweatybridge sweatybridge Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be an edge case that results in double nested download directory.

  1. Create a single supabase/functions/demo/index.ts file.
// Setup type definitions for built-in Supabase Runtime APIs
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
console.info('server started');
Deno.serve(async (req)=>{
  const { name } = await req.json();
  const data = {
    message: `Hello ${name}!`
  };
  return new Response(JSON.stringify(data), {
    headers: {
      'Content-Type': 'application/json',
      'Connection': 'keep-alive'
    }
  });
});
  1. Deploy using docker
go run . functions deploy demo
  1. Download using api
go run . functions download --use-api demo
  1. Observe that we have the following file created.
supabase/functions/hello-world/functions/hello-world/index.ts

This is not reproducible if we include supabase/functions/demo/deno.json file together with index.ts

Copy link
Contributor

@laktek laktek Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed this behavior even in the current Docker-based downloads. This may be related to https://linear.app/supabase/issue/FUNC-304/auto-packagejson-detection-is-causing-confusion-for-users cc: @nyannyacha

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not able to reproduce this by following the steps provided 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still no repro for me but I've made this PR more robust now anyway, should we try to track this bug separately?

@johnstonmatt johnstonmatt disabled auto-merge October 31, 2025 09:20
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

Successfully merging this pull request may close these issues.

5 participants