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

Wrong Content-Type return parsing for application/pdf on edge function #18175

Open
PhilippS93 opened this issue Oct 13, 2023 · 3 comments · May be fixed by supabase/functions-js#72
Open

Wrong Content-Type return parsing for application/pdf on edge function #18175

PhilippS93 opened this issue Oct 13, 2023 · 3 comments · May be fixed by supabase/functions-js#72
Labels
bug Something isn't working edge functions pr-opened A PR has been opened to resolve the issue

Comments

@PhilippS93
Copy link

Bug report

When returning a buffer in an edge function with type application/pdf, the supabase JS client does not parse the result correctly. It is parsed as a string, but not as a blob.

It is stated here, that the return parsing depends on the content-type of the result, so the application/pdf should be parsed as blob. Instead, it is parsed as a string.
When changing the type to e.g. application/octet-stream, it is correctly parsed as a blob.

So, when using the JS supabase library (await this.supabase.functions.invoke()), it parsed the result incorrectly.

Also, when using e.g. Postman and testing the same function with type application/pdf, the correct pdf is shown, so the result is correct.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create an edge function with return type application/pdf
  2. Return a pdf file as Uint8Array
  3. Invoke the function using the JS supabase library
  4. The result data is a string instead of a blob

Expected behavior

The result should be parsed correctly

System information

  • "@supabase/supabase-js": "2.38.1"
@flogy
Copy link

flogy commented Nov 1, 2023

Having the same issue with content type application/vnd.openxmlformats-officedocument.wordprocessingml.document (DOCX).

@encima encima added the pr-opened A PR has been opened to resolve the issue label Jan 18, 2024
@Hallidayo Hallidayo moved this to PR Review in Open Source Maintainers May 16, 2024
@Hallidayo Hallidayo moved this from PR Review to To Close in Open Source Maintainers May 16, 2024
@Hallidayo Hallidayo moved this from To Close to PR Review in Open Source Maintainers May 16, 2024
@markbenliyan
Copy link

Have this exact issue right now, quite blocking on work any workarounds you've come up with?

@MariusWilsch
Copy link

Hay, why did nobody merge this pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working edge functions pr-opened A PR has been opened to resolve the issue
Projects
Status: PR Review
Development

Successfully merging a pull request may close this issue.

6 participants