Skip to content

Edge Functions are limited to method POST #104

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

Closed
Kalzem opened this issue Aug 9, 2023 · 3 comments · Fixed by supabase-community/functions-swift#3
Closed

Edge Functions are limited to method POST #104

Kalzem opened this issue Aug 9, 2023 · 3 comments · Fixed by supabase-community/functions-swift#3
Assignees
Labels
enhancement New feature or request

Comments

@Kalzem
Copy link

Kalzem commented Aug 9, 2023

Feature request

Is your feature request related to a problem? Please describe.

I believe Edge Functions should not be limited to POST methods.
There is an official example of a CRUD edge function.

I have a few functions that rely on GET / PUT methods.

Describe the solution you'd like

Add a parameter to struct FunctionInvokeOptions that would allow to choose the HTTP method from either an enum or a string.

Additional context

The only workaround I found as of today is to split an edge function that handles GET/PUT/POST/DELETE into 4 functions that ignore the HTTP method.

@Kalzem Kalzem added the enhancement New feature or request label Aug 9, 2023
@grdsdev
Copy link
Collaborator

grdsdev commented Aug 9, 2023

Hey @Kalzem thanks for opening this issue, that makes sense, I'm going to send a PR fixing this.

Thanks again.

@grdsdev grdsdev self-assigned this Aug 9, 2023
@bwship
Copy link

bwship commented Aug 9, 2023

Awesome. I was just about to raise this issue. I haven't investigated path params working or not, but if you are in there getting http methods working, you might want to look at that too. for instance, I have an /invitations POST, but then want to also have a /invitations/:id PUT request. Not sure if it handle that, because I only see the body and headers as able to be set.

@grdsdev
Copy link
Collaborator

grdsdev commented Aug 10, 2023

Hey @bwship you can use as following:

try await supabase.functions.invoke(
    "invitations/\(id)",
    options: .init(method: .put)
)

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

Successfully merging a pull request may close this issue.

3 participants