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

🐛 BUG: @astrojs/netlify/functions doesn't support base64 encoded responses #3586

Closed
1 task done
tony-sull opened this issue Jun 13, 2022 · 0 comments · Fixed by #3592
Closed
1 task done

🐛 BUG: @astrojs/netlify/functions doesn't support base64 encoded responses #3586

tony-sull opened this issue Jun 13, 2022 · 0 comments · Fixed by #3592
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: ssr Related to SSR (scope)

Comments

@tony-sull
Copy link
Contributor

What version of astro are you using?

1.0.0-beta.44

Are you using an SSR adapter? If so, which one?

Netlify

What package manager are you using?

pnpm

What operating system are you using?

Mac

Describe the Bug

Netlify Functions requires that the function's body is a string. To support certain use cases like returning a Buffer for an image, the response needs to be base64 encoded and include the isBase64Encoded flag

@astrojs/netlify/functions currently only supports text responses and doesn't have a way to use the isBase64Encoded flag

Possible Solutions

This is a tricky one since API endpoints only return a standard Response object. For Netlify, it could potentially check if response.body is a string, and if not assume it needs to be base64 encoded

Another option would be adding a custom header in the endpoint Response, but that could be a little weird since it really is adapter specific

Link to Minimal Reproducible Example

na

Participation

  • I am willing to submit a pull request for this issue.
@tony-sull tony-sull added needs discussion Issue needs to be discussed feat: ssr Related to SSR (scope) labels Jun 13, 2022
@tony-sull tony-sull self-assigned this Jun 13, 2022
@tony-sull tony-sull added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs discussion Issue needs to be discussed labels Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: ssr Related to SSR (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant