feat(functions) update functions template to match new 'server' style#5063
feat(functions) update functions template to match new 'server' style#5063kallebysantos wants to merge 9 commits intosupabase:developfrom
Conversation
Coverage Report for CI Build 25128379328Coverage decreased (-0.04%) to 63.715%Details
Uncovered Changes
Coverage Regressions11 previously-covered lines in 4 files lost coverage.
Coverage Stats
💛 - Coveralls |
|
WIP: Do not merge until |
avallete
left a comment
There was a problem hiding this comment.
A few comments. Otherwise LGTM.
| "imports": { | ||
| "@supabase/functions-js": "jsr:@supabase/functions-js@^2" | ||
| "@supabase/functions-js": "jsr:@supabase/functions-js@^2", | ||
| "@supabase/server": "npm:@supabase/server" |
There was a problem hiding this comment.
question
Should this be pinned to a major version like for functions-js ?
There was a problem hiding this comment.
also maybe we use always jsr: or npm: for all imports on these sample codes...
There was a problem hiding this comment.
It would be nice, but I remember a previous issue where was decided to use the deno.json file to import packages.
Not sure if I should just add it as in-line import directly from jsr: same way I keep for dashboard templates
There was a problem hiding this comment.
I don't get it 🤔
The current @supabase/functions-js is in deno.json but still import from jsr: with a fixed major version. Not a deno expert though but it seems that we could do the both that way ?
Also, from our docs, the deno.json approach is the preferred one: https://supabase.com/docs/guides/functions/dependencies#using-denojson-recommended
Which make sense, it's much easier and reliable for us to bundle the functions locally with that approach (I think that's the reason why we made this the recommended way).
- Creating different templates for 'functions new' command - Handling '--auth' flag to specify which template use
6b96df4 to
b24c3aa
Compare
What kind of change does this PR introduce?
Feature
What is the new behavior?
Apply
withSupabasehelper from@supabase/serverAdditional context
A new optional flag
--authwas introduced for thefunctions newcommand, chose between the auth access template:alwaysNo credentials required - Open endpoints, wrappers that handle their own authapikeyValid publishable key or secret key - Use respectively for Client-facing, key-validated endpoints or Server-to-server, internal callsuserUser JWT required - Authenticated user endpointsCurrent default
--auth apikey--
Towards FUNC-563