Serve binary file (jpeg) from serverless function on dev server

I am hosting some function on

As you can see the image gets served fine on the deployed site.
However when running netlify functions:serve and I visit the same function path on localhost the image cannot be displayed, because the dev server sends non decoded base64 to my browser.

This is the code for the serverless function

package main

import (


// snip...

func getFileResponse(file *minio.Object) (*events.APIGatewayProxyResponse, error) {
	buf, err := io.ReadAll(file)
	if err != nil {
		return nil, fmt.Errorf("failed to read file: %s", err)

	encodedBuf := base64.StdEncoding.EncodeToString(buf)

	return &events.APIGatewayProxyResponse{
		StatusCode:      200,
		Body:            encodedBuf,
		IsBase64Encoded: true,
		Headers: map[string]string{
			"Content-Type": "image/jpeg",
	}, nil

// snip...

func handler() ...

func main() {

Hi @haasal :wave:t6: ,

Welcome to the forums thanks so much for reaching out. I’m not sure if that’s a bug buy you can file a bug on the CLI repository if you’d like our dev team to investigate. Sorry I couldn’t be of more help. Issues · netlify/cli · GitHub