1

So I have a node running on an EC2 instance using ipfs kubo docker library. I wrote a simple upload API in Go using ipfs-go-api package that will connect to the node in EC2, upload the image and return its hash.

When I deploy the API locally it works (connects to EC2, uploads and returns hash) but when I deploy the same API to lambda it gives a 502 error which the message,

Post “/api/v0/add”: unexpected redirect: Error null

Any troubleshooting tips to resolve this? Am I missing some configuration steps?

This is the part that has the file content from the API call and tries to upload to the IPFS node in my EC2

res := events.APIGatewayProxyResponse{}
r, err := aws.NewReaderMultipart(req)
if err != nil {
    return res, err
}
part, err := r.NextPart()
if err != nil {
    return res, err
}
content, err := io.ReadAll(part)
if err != nil {
    return res, err
}
sh := shell.NewShell(EC2_HOST_IP)

cid, err := sh.Add(bytes.NewReader(content))

NOTE: even if I try to add just strings as content, I get the same error

Vasu Mistry
  • 781
  • 2
  • 6
  • 18

0 Answers0