502 Error Lambda Not Passing Validation? Urgent

import { APIGatewayEvent } from "aws-lambda";

import fetch from “node-fetch”;

export async function handler(event: APIGatewayEvent) {
try {
const res = await fetch(
http://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlNzbP97U9sKh0jjxbPbfOKg.ttf
);
let buffer = await res.buffer();
return {
statusCode: 200,
headers: {
“Content-Type”: “aplication/font-sfnt”
},
body: buffer,
isBase64Encoded: false
};
} catch (error) {
console.log(error);
}
}

I cannot return a stringified buffer because the file is being used by a library that cannot handle stringified data.

This function, of course, works fine in development mode, but does not work in production.

Any ideas?

Hi @seanaguinaga, I’m pretty sure the APIGatewayEvent won’t work since we use our own api gateway and that method is specific to AWS’s api gateway. We do already provide the event object by default. Once you make that change, let me know if things still don’t work.