so I have a express sever hosted on netlify at https://meek-gecko-000509.netlify.app/ using netlify functions, everything works almost fine but one specific api endpoint doesnt , the /api/png for example main version running in other place will show hypixel’s logo at https://heatblock.esb.is-a.dev/api/png/mc.hypixel.net while the sever hosted at netlify returns a eroor image at https://meek-gecko-000509.netlify.app/api/png/mc.hypixel.net while all other endpoints work
If this is the code: hb-test/index.js at main · EducatedSuddenBucket/hb-test, then it’s not in the expected format. You can’t have:
module.exports.handler = serverless(app);
module.exports = serverless(app);
This won’t work as you’re essentially doing the following:
module: {
exports: {
handler: serverless(app)
}
}
and then, you’re doing:
module: {
exports: serverless(app)
}
So the handler
property is removed which is exactly what the error says:
Runtime.HandlerNotFound - index.handler is undefined or not exported
Please refer to: Express on Netlify | Netlify Docs
i was just testing by editing my code , the time i crated the thread i had only
module.exports.handler = serverless(app);
also i reverted back to using that so pls check now
I’m not sure what you’re trying to do. Why is it not possible to simply use fetch()
? When I’m trying to load mc.hypixel.net
, I never get a response myself.
i made a video showing what is happening: https://www.youtube.com/watch?v=mB-PFp8RTAw
other api endpoints work fine
bumping thread to get follow up
fixed by replacing this
module.exports.handler = serverless(app);
With this
module.exports.handler = serverless(app, {
binary: ['image/png'],
});