I am trying to return an image from my lambda function
Here is my return. code:
// Your server-side functionality
return &events.APIGatewayProxyResponse{
StatusCode: 200,
Headers: map[string]string{
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type",
"Content-Type": "image/png",
"Content-Length": fmt.Sprintf("%d", len(b64img)),
},
Body: b64img,
IsBase64Encoded: true,
}, nil
I did profile the Body with a Curl request, so there is a return value. I have read that this is a known bug on Netlify, is there a workaround?
I still get the broken image from the browser
Netlify Site Name: Hokr
What’s the name of the function handling this and how can we reproduce the issue? I see many functions on that site.
I have been running it locally, here is the endpoint and the error:
https://hokr.xyz/.netlify/functions/Image
Here is the current error:
This function has crashed
An unhandled error in the function code triggered the following message:
FormatError - png: invalid format: invalid image size: 0x0
Connection details
Netlify internal ID: 01H1SJA9MDDYQ7X719WR2KEBY7
I have tracked it down to the referenced images in my go func.
How do I access images in my public folder via file path from Go?
is stored here:
/public/backgrounds/eye.png
But I don’t know how to reference that from my gocode.
I now have the component parts stored in my serverless function directory, still not referencing the images.
From what I can tell, the issue is my graphics lib.
SamO
7
Well thanks from coming back and sharing this with the community.