Hi there,
I’m trying to create a website with a function using digest deploys with API.
(I’m following this doc Get started with the Netlify API | Netlify Docs)
I can successfully deploy a site without a function, but I want to deploy with a function.
I send the request to create the site with the following payload:
{
"async": true,
"files": {
"/404/index.html": "0f23c546eedb3821696491c99cc955223cbf22c9",
"/Fruits/index.html": "eda72f7b881defd80c9e961d39f82179313ba533",
"/ContactUs/index.html": "23277c62408f72dc4d208ae39ad217622f85ba26",
"/ContactUs/styles.css": "771d57c349a57c1250ba7bd52e05f6539031034c",
"/Fruits/styles.css": "596aec9e20a7b605b5bffe31bd86abc3059246c6",
"/content/gauva.svg": "4ec20616d6778f026d5b541324ef1482cdb410f6",
"/content/grapes.svg": "85bd194386db7b610949b6528af185d9be09b27d",
"/content/twitter-with-circle.svg": "c43c452e2a2dc721cb9dd6b1bd4b163cd16b8155",
"/content/linkedin-with-circle.svg": "efd6708f9be4bf30e3d7fbc083e3c406ef8b3cee",
"/404/styles.css": "a7c341616f92d229783dc376d0a16ad24403065c",
"/content/facebook-with-circle.svg": "af6b52dce28ed554eba8420e35cc8a5bef5095e6",
"/content/orange.png": "462886f2a997ef65c7eee0b22db32818da0ee88b",
"/content/tasty-image.png": "0886762caaf315d5728d17605b69ec2b917d6861",
"/content/а.svg": "050a1274cad58270bb1933fc9f3cd91e38bb6713",
"/content/grapes.png": "294150ecd3ee303240499bbc167f1867f4b2decf",
"/content/slide-img.png": "2848f848090e85c1fe57b82c32c312f6237aaf9d",
...etc...
},
"functions": {
"publisher": "a5c7586429a434a3c54fee2b382c484482311769"
}
}
The function was zipped with the following structure
publisher/publisher.js => publisher.zip
I calculated the SHA for publisher.zip => “a5c7586429a434a3c54fee2b382c484482311769”
Function code (simple as possible):
exports.handler = function (event, context, callback) {
callback(null, {
statusCode: 200,
body: "Hello, World",
});
};
After creating the site, I send the request to upload publisher.zip file content
PUT to https://api.netlify.com/api/v1/deploys/${deployId}/files/functions/publisher.zip
response like:
{
id: 'functions/publisher.zip'
mime_type: 'application/zip'
path: 'functions/publisher.zip'
sha: 'a5c7586429a434a3c54fee2b382c484482311769'
size: 253
}
I see the site and function in the dashboard UI
But then I try to check created function I get the Invalid request message in logs:
If I try to open deployed function I see 500 error
Is it possible to get more detailed logs to better understand what is wrong with my function?
My netlify app is https://scintillating-licorice-606074.netlify.app
(I also tried to upload the function as a file but got the same result. Please check Netlify App )
Thanks