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

Prod deploy #3315

Merged
merged 26 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e6c8257
chore(deps): bump supabase/supavisor from 2.4.12 to 2.4.13 in /pkg/co…
dependabot[bot] Mar 14, 2025
b747cee
chore(deps): bump supabase/realtime from v2.34.40 to v2.34.41 in /pkg…
dependabot[bot] Mar 14, 2025
a9156af
fix: revert logflare to 1.12.0 (#3305)
sweatybridge Mar 14, 2025
67ac74e
chore(deps): bump supabase/postgres from 15.8.1.049 to 15.8.1.053 in …
dependabot[bot] Mar 14, 2025
64facde
feat: allow deno version in config (#3304)
sweatybridge Mar 14, 2025
853bc96
fix: link password flag override (#3295)
sweatybridge Mar 14, 2025
fdfe36c
chore(deps): bump github.com/spf13/afero from 1.12.0 to 1.14.0 (#3309)
dependabot[bot] Mar 17, 2025
bc0db16
chore(deps): bump supabase/realtime from v2.34.41 to v2.34.43 in /pkg…
dependabot[bot] Mar 17, 2025
acdf6f1
chore(deps): bump github.com/BurntSushi/toml from 1.4.1-0.20240526193…
dependabot[bot] Mar 18, 2025
d216ca9
fix: add slug to bundler interface
sweatybridge Mar 17, 2025
c994c16
chore: remove unnecessary filter
sweatybridge Mar 17, 2025
274173a
fix: return deploy metadata from bundle
sweatybridge Mar 17, 2025
10a2cbb
chore(deps): bump supabase/studio in /pkg/config/templates
dependabot[bot] Mar 17, 2025
c5d40f7
fix: update docker id before db pull (#3320)
sweatybridge Mar 18, 2025
cf503a4
chore(deps): bump github.com/golangci/golangci-lint from 1.64.7 to 1.…
dependabot[bot] Mar 19, 2025
dfa3dd3
chore(deps): bump supabase/postgres from 15.8.1.054 to 15.8.1.056 in …
dependabot[bot] Mar 19, 2025
742eba1
chore(deps): bump supabase/supavisor from 2.4.13 to 2.4.14 in /pkg/co…
dependabot[bot] Mar 19, 2025
f7a7ec7
chore(deps): bump supabase/postgres-meta from v0.86.1 to v0.87.1 in /…
dependabot[bot] Mar 20, 2025
9366a17
chore(deps): bump github.com/docker/cli from 28.0.1+incompatible to 2…
dependabot[bot] Mar 20, 2025
cc3f2f1
chore(deps): bump github.com/docker/docker from 28.0.1+incompatible t…
dependabot[bot] Mar 21, 2025
5a1c3cb
chore(deps): bump supabase/postgres from 15.8.1.056 to 15.8.1.058 in …
dependabot[bot] Mar 21, 2025
e8d1ae9
chore(deps): bump github.com/golang-jwt/jwt/v5 from 5.2.1 to 5.2.2 (#…
dependabot[bot] Mar 21, 2025
8b1b198
chore(docs): Remove v1 from title (#3336)
andyfleming Mar 22, 2025
418caee
chore(deps): bump supabase/edge-runtime from v1.67.2 to v1.67.3 in /p…
dependabot[bot] Mar 24, 2025
e96998f
chore(deps): bump supabase/edge-runtime from v1.67.3 to v1.67.4 in /p…
dependabot[bot] Mar 25, 2025
c8778df
chore(deps): bump supabase/postgres from 15.8.1.058 to 15.8.1.060 in …
dependabot[bot] Mar 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Supabase CLI (v1)
# Supabase CLI

[![Coverage Status](https://coveralls.io/repos/github/supabase/cli/badge.svg?branch=main)](https://coveralls.io/github/supabase/cli?branch=main) [![Bitbucket Pipelines](https://img.shields.io/bitbucket/pipelines/supabase-cli/setup-cli/master?style=flat-square&label=Bitbucket%20Canary)](https://bitbucket.org/supabase-cli/setup-cli/pipelines) [![Gitlab Pipeline Status](https://img.shields.io/gitlab/pipeline-status/sweatybridge%2Fsetup-cli?label=Gitlab%20Canary)
](https://gitlab.com/sweatybridge/setup-cli/-/pipelines)
Expand Down
3 changes: 2 additions & 1 deletion cmd/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ var (
if err := flags.LoadConfig(fsys); err != nil {
return err
}
// TODO: move this to root cmd
cobra.CheckErr(viper.BindPFlag("DB_PASSWORD", cmd.Flags().Lookup("password")))
return link.Run(ctx, flags.ProjectRef, fsys)
},
}
Expand All @@ -43,6 +45,5 @@ func init() {
linkFlags.StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.")
linkFlags.StringVarP(&dbPassword, "password", "p", "", "Password to your remote Postgres database.")
// For some reason, BindPFlag only works for StringVarP instead of StringP
cobra.CheckErr(viper.BindPFlag("DB_PASSWORD", linkFlags.Lookup("password")))
rootCmd.AddCommand(linkCmd)
}
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ module github.com/supabase/cli

go 1.23.2

toolchain go1.24.1

require (
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c
github.com/BurntSushi/toml v1.5.0
github.com/Netflix/go-env v0.1.2
github.com/andybalholm/brotli v1.1.1
github.com/cenkalti/backoff/v4 v4.3.0
Expand All @@ -12,17 +14,17 @@ require (
github.com/charmbracelet/glamour v0.7.0
github.com/charmbracelet/lipgloss v0.12.1
github.com/containers/common v0.62.2
github.com/docker/cli v28.0.1+incompatible
github.com/docker/docker v28.0.1+incompatible
github.com/docker/cli v28.0.2+incompatible
github.com/docker/docker v28.0.2+incompatible
github.com/docker/go-connections v0.5.0
github.com/docker/go-units v0.5.0
github.com/ecies/go/v2 v2.0.10
github.com/getsentry/sentry-go v0.31.1
github.com/go-errors/errors v1.5.1
github.com/go-git/go-git/v5 v5.14.0
github.com/go-xmlfmt/xmlfmt v1.1.3
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/golangci/golangci-lint v1.64.7
github.com/golang-jwt/jwt/v5 v5.2.2
github.com/golangci/golangci-lint v1.64.8
github.com/google/go-github/v62 v62.0.0
github.com/google/go-querystring v1.1.0
github.com/google/uuid v1.6.0
Expand All @@ -39,7 +41,7 @@ require (
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
github.com/oapi-codegen/runtime v1.1.1
github.com/slack-go/slack v0.16.0
github.com/spf13/afero v1.12.0
github.com/spf13/afero v1.14.0
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.6
github.com/spf13/viper v1.19.0
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBg
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg=
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Crocmagnon/fatcontext v0.7.1 h1:SC/VIbRRZQeQWj/TcQBS6JmrXcfA+BU4OGSVUt54PjM=
github.com/Crocmagnon/fatcontext v0.7.1/go.mod h1:1wMvv3NXEBJucFGfwOJBxSVWcoIO6emV215SMkW9MFU=
Expand Down Expand Up @@ -226,13 +226,13 @@ github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxK
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk=
github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE=
github.com/docker/cli v28.0.1+incompatible h1:g0h5NQNda3/CxIsaZfH4Tyf6vpxFth7PYl3hgCPOKzs=
github.com/docker/cli v28.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli v28.0.2+incompatible h1:cRPZ77FK3/IXTAIQQj1vmhlxiLS5m+MIUDwS6f57lrE=
github.com/docker/cli v28.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v28.0.1+incompatible h1:FCHjSRdXhNRFjlHMTv4jUNlIBbTeRjrWfeFuJp7jpo0=
github.com/docker/docker v28.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v28.0.2+incompatible h1:9BILleFwug5FSSqWBgVevgL3ewDJfWWWyZVqlDMttE8=
github.com/docker/docker v28.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo=
github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
Expand Down Expand Up @@ -370,8 +370,8 @@ github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down Expand Up @@ -410,8 +410,8 @@ github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUP
github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s=
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d h1:viFft9sS/dxoYY0aiOTsLKO2aZQAPT4nlQCsimGcSGE=
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d/go.mod h1:ivJ9QDg0XucIkmwhzCDsqcnxxlDStoTl89jDMIoNxKY=
github.com/golangci/golangci-lint v1.64.7 h1:Xk1EyxoXqZabn5b4vnjNKSjCx1whBK53NP+mzLfX7HA=
github.com/golangci/golangci-lint v1.64.7/go.mod h1:5cEsUQBSr6zi8XI8OjmcY2Xmliqc4iYL7YoPrL+zLJ4=
github.com/golangci/golangci-lint v1.64.8 h1:y5TdeVidMtBGG32zgSC7ZXTFNHrsJkDnpO4ItB3Am+I=
github.com/golangci/golangci-lint v1.64.8/go.mod h1:5cEsUQBSr6zi8XI8OjmcY2Xmliqc4iYL7YoPrL+zLJ4=
github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs=
github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo=
github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+2f7zX0H6Jkw1Ol6c=
Expand Down Expand Up @@ -905,8 +905,8 @@ github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCp
github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs=
github.com/speakeasy-api/openapi-overlay v0.9.0 h1:Wrz6NO02cNlLzx1fB093lBlYxSI54VRhy1aSutx0PQg=
github.com/speakeasy-api/openapi-overlay v0.9.0/go.mod h1:f5FloQrHA7MsxYg9djzMD5h6dxrHjVVByWKh7an8TRc=
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
github.com/spf13/cast v0.0.0-20150508191742-4d07383ffe94/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
Expand Down
22 changes: 11 additions & 11 deletions internal/functions/deploy/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/spf13/afero"
"github.com/spf13/viper"
"github.com/supabase/cli/internal/utils"
"github.com/supabase/cli/pkg/api"
"github.com/supabase/cli/pkg/function"
)

Expand All @@ -25,18 +26,17 @@ func NewDockerBundler(fsys afero.Fs) function.EszipBundler {
return &dockerBundler{fsys: fsys}
}

func (b *dockerBundler) Bundle(ctx context.Context, entrypoint string, importMap string, staticFiles []string, output io.Writer) error {
// Create temp directory to store generated eszip
slug := filepath.Base(filepath.Dir(entrypoint))
func (b *dockerBundler) Bundle(ctx context.Context, slug, entrypoint, importMap string, staticFiles []string, output io.Writer) (api.FunctionDeployMetadata, error) {
meta := function.NewMetadata(slug, entrypoint, importMap, staticFiles)
fmt.Fprintln(os.Stderr, "Bundling Function:", utils.Bold(slug))
cwd, err := os.Getwd()
if err != nil {
return errors.Errorf("failed to get working directory: %w", err)
return meta, errors.Errorf("failed to get working directory: %w", err)
}
// BitBucket pipelines require docker bind mounts to be world writable
hostOutputDir := filepath.Join(utils.TempDir, fmt.Sprintf(".output_%s", slug))
if err := b.fsys.MkdirAll(hostOutputDir, 0777); err != nil {
return errors.Errorf("failed to mkdir: %w", err)
return meta, errors.Errorf("failed to mkdir: %w", err)
}
defer func() {
if err := b.fsys.RemoveAll(hostOutputDir); err != nil {
Expand All @@ -46,16 +46,16 @@ func (b *dockerBundler) Bundle(ctx context.Context, entrypoint string, importMap
// Create bind mounts
binds, err := GetBindMounts(cwd, utils.FunctionsDir, hostOutputDir, entrypoint, importMap, b.fsys)
if err != nil {
return err
return meta, err
}
hostOutputPath := filepath.Join(hostOutputDir, "output.eszip")
// Create exec command
cmd := []string{"bundle", "--entrypoint", utils.ToDockerPath(entrypoint), "--output", utils.ToDockerPath(hostOutputPath)}
if len(importMap) > 0 {
cmd = append(cmd, "--import-map", utils.ToDockerPath(importMap))
}
for _, staticFile := range staticFiles {
cmd = append(cmd, "--static", utils.ToDockerPath(staticFile))
for _, sf := range staticFiles {
cmd = append(cmd, "--static", utils.ToDockerPath(sf))
}
if viper.GetBool("DEBUG") {
cmd = append(cmd, "--verbose")
Expand All @@ -82,15 +82,15 @@ func (b *dockerBundler) Bundle(ctx context.Context, entrypoint string, importMap
os.Stdout,
os.Stderr,
); err != nil {
return err
return meta, err
}
// Read and compress
eszipBytes, err := b.fsys.Open(hostOutputPath)
if err != nil {
return errors.Errorf("failed to open eszip: %w", err)
return meta, errors.Errorf("failed to open eszip: %w", err)
}
defer eszipBytes.Close()
return function.Compress(eszipBytes, output)
return meta, function.Compress(eszipBytes, output)
}

func GetBindMounts(cwd, hostFuncDir, hostOutputDir, hostEntrypointPath, hostImportMapPath string, fsys afero.Fs) ([]string, error) {
Expand Down
51 changes: 50 additions & 1 deletion internal/functions/deploy/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import (
"archive/zip"
"bytes"
"context"
"fmt"
"net/http"
"os"
"path/filepath"
"testing"

"github.com/h2non/gock"
Expand All @@ -13,16 +16,21 @@ import (
"github.com/stretchr/testify/require"
"github.com/supabase/cli/internal/testing/apitest"
"github.com/supabase/cli/internal/utils"
"github.com/supabase/cli/pkg/cast"
)

func TestDockerBundle(t *testing.T) {
imageUrl := utils.GetRegistryImageUrl(utils.Config.EdgeRuntime.Image)
utils.EdgeRuntimeId = "test-edge-runtime"
const containerId = "test-container"
cwd, err := os.Getwd()
require.NoError(t, err)

t.Run("throws error on bundle failure", func(t *testing.T) {
// Setup in-memory fs
fsys := afero.NewMemMapFs()
absImportMap := filepath.Join(cwd, "hello", "deno.json")
require.NoError(t, utils.WriteFile(absImportMap, []byte("{}"), fsys))
// Setup deno error
t.Setenv("TEST_DENO_ERROR", "bundle failed")
var body bytes.Buffer
Expand All @@ -42,10 +50,51 @@ func TestDockerBundle(t *testing.T) {
require.NoError(t, apitest.MockDocker(utils.Docker))
apitest.MockDockerStart(utils.Docker, imageUrl, containerId)
require.NoError(t, apitest.MockDockerLogsExitCode(utils.Docker, containerId, 1))
// Setup mock bundler
bundler := NewDockerBundler(fsys)
// Run test
err = NewDockerBundler(fsys).Bundle(context.Background(), "", "", []string{}, &body)
meta, err := bundler.Bundle(
context.Background(),
"hello",
filepath.Join("hello", "index.ts"),
filepath.Join("hello", "deno.json"),
[]string{filepath.Join("hello", "data.pdf")},
&body,
)
// Check error
assert.ErrorContains(t, err, "error running container: exit 1")
assert.Empty(t, apitest.ListUnmatchedRequests())
assert.Equal(t, cast.Ptr("hello"), meta.Name)
entrypoint := fmt.Sprintf("file://%s/hello/index.ts", filepath.ToSlash(cwd))
assert.Equal(t, entrypoint, meta.EntrypointPath)
importMap := fmt.Sprintf("file://%s/hello/deno.json", filepath.ToSlash(cwd))
assert.Equal(t, &importMap, meta.ImportMapPath)
staticFile := fmt.Sprintf("file://%s/hello/data.pdf", filepath.ToSlash(cwd))
assert.Equal(t, cast.Ptr([]string{staticFile}), meta.StaticPatterns)
assert.Nil(t, meta.VerifyJwt)
})

t.Run("throws error on permission denied", func(t *testing.T) {
// Setup in-memory fs
fsys := afero.NewReadOnlyFs(afero.NewMemMapFs())
// Setup mock bundler
bundler := NewDockerBundler(fsys)
// Run test
meta, err := bundler.Bundle(
context.Background(),
"hello",
"hello/index.ts",
"",
nil,
nil,
)
// Check error
assert.ErrorIs(t, err, os.ErrPermission)
assert.Equal(t, cast.Ptr("hello"), meta.Name)
entrypoint := fmt.Sprintf("file://%s/hello/index.ts", filepath.ToSlash(cwd))
assert.Equal(t, entrypoint, meta.EntrypointPath)
assert.Nil(t, meta.ImportMapPath)
assert.NotNil(t, meta.StaticPatterns)
assert.Nil(t, meta.VerifyJwt)
})
}
2 changes: 1 addition & 1 deletion internal/utils/flags/db_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func ParseDatabaseConfig(flagSet *pflag.FlagSet, fsys afero.Fs) error {
// Update connection config
switch connType {
case direct:
if err := utils.Config.Load("", utils.NewRootFS(fsys)); err != nil && !errors.Is(err, os.ErrNotExist) {
if err := LoadConfig(fsys); err != nil {
return err
}
if flag := flagSet.Lookup("db-url"); flag != nil {
Expand Down
11 changes: 11 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ type (
Policy RequestPolicy `toml:"policy"`
InspectorPort uint16 `toml:"inspector_port"`
Secrets SecretsConfig `toml:"secrets"`
DenoVersion uint `toml:"deno_version"`
}

SecretsConfig map[string]Secret
Expand Down Expand Up @@ -827,6 +828,16 @@ func (c *config) Validate(fsys fs.FS) error {
return err
}
}
switch c.EdgeRuntime.DenoVersion {
case 0:
return errors.New("Missing required field in config: edge_runtime.deno_version")
case 1:
break
case 2:
c.EdgeRuntime.Image = deno2
default:
return errors.Errorf("Failed reading config: Invalid %s: %v.", "edge_runtime.deno_version", c.EdgeRuntime.DenoVersion)
}
// Validate logflare config
if c.Analytics.Enabled {
if c.Analytics.Backend == LogflareBigQuery {
Expand Down
5 changes: 3 additions & 2 deletions pkg/config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
)

const (
pg13 = "supabase/postgres:13.3.0"
pg14 = "supabase/postgres:14.1.0.89"
pg13 = "supabase/postgres:13.3.0"
pg14 = "supabase/postgres:14.1.0.89"
deno2 = "supabase/edge-runtime:v1.68.0-develop.8"
)

type images struct {
Expand Down
14 changes: 7 additions & 7 deletions pkg/config/templates/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Exposed for updates by .github/dependabot.yml
FROM supabase/postgres:15.8.1.049 AS pg15
FROM supabase/postgres:15.8.1.060 AS pg15
# Append to ServiceImages when adding new dependencies below
FROM library/kong:2.8.1 AS kong
FROM axllent/mailpit:v1.22.3 AS mailpit
FROM postgrest/postgrest:v12.2.8 AS postgrest
FROM supabase/postgres-meta:v0.86.1 AS pgmeta
FROM supabase/studio:20250224-d10db0f AS studio
FROM supabase/postgres-meta:v0.87.1 AS pgmeta
FROM supabase/studio:20250317-6955350 AS studio
FROM darthsim/imgproxy:v3.8.0 AS imgproxy
FROM supabase/edge-runtime:v1.67.2 AS edgeruntime
FROM supabase/edge-runtime:v1.67.4 AS edgeruntime
FROM timberio/vector:0.28.1-alpine AS vector
FROM supabase/supavisor:2.4.12 AS supavisor
FROM supabase/supavisor:2.4.14 AS supavisor
FROM supabase/gotrue:v2.170.0 AS gotrue
FROM supabase/realtime:v2.34.40 AS realtime
FROM supabase/realtime:v2.34.43 AS realtime
FROM supabase/storage-api:v1.19.3 AS storage
FROM supabase/logflare:1.12.5 AS logflare
FROM supabase/logflare:1.12.0 AS logflare
# Append to JobImages when adding new dependencies below
FROM supabase/pgadmin-schema-diff:cli-0.0.5 AS differ
FROM supabase/migra:3.0.1663481299 AS migra
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/templates/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ sign_in_sign_ups = 30
# Number of OTP / Magic link verifications that can be made in a 5 minute interval per IP address.
token_verifications = 30


# Configure one of the supported captcha providers: `hcaptcha`, `turnstile`.
# [auth.captcha]
# enabled = true
Expand Down Expand Up @@ -283,6 +282,8 @@ enabled = true
policy = "oneshot"
# Port to attach the Chrome inspector for debugging edge functions.
inspector_port = 8083
# The Deno major version to use.
deno_version = 1

# [edge_runtime.secrets]
# secret_key = "env(SECRET_VALUE)"
Expand Down
1 change: 1 addition & 0 deletions pkg/config/testdata/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ enabled = true
# Use `oneshot` for hot reload, or `per_worker` for load testing.
policy = "per_worker"
inspector_port = 8083
deno_version = 2

[edge_runtime.secrets]
test_key = "test_value"
Expand Down
2 changes: 1 addition & 1 deletion pkg/function/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type EdgeRuntimeAPI struct {
}

type EszipBundler interface {
Bundle(ctx context.Context, entrypoint string, importMap string, staticFiles []string, output io.Writer) error
Bundle(ctx context.Context, slug, entrypoint, importMap string, staticFiles []string, output io.Writer) (api.FunctionDeployMetadata, error)
}

func NewEdgeRuntimeAPI(project string, client api.ClientWithResponses, opts ...withOption) EdgeRuntimeAPI {
Expand Down
Loading
Loading