Issue with deploy function using Netlify API

Hey @hrishikesh
I got the same error for the deployment of the site with the publisher function
(calculated SHA for publisher.js → created publisher.zip → send content in body),
please check Site ID: bece880e-aafc-47b4-8930-69ee34aee63e

I used the following function for SHA256:

const calculateSha256 = (data: NodeJS.ReadableStream): Promise<string> => {
    const hash = crypto.createHash("sha256").setEncoding('hex');
    return new Promise((resolve, reject) => data.on('error', reject)
            .pipe(hash)
            .once('finish', () => resolve(hash.read()))
    );
}

You need to create SHA256 for the zip of the function that you generate and not the other way round. So the process is like:

Generate the zip of the function → Create SHA256 of that → Send that zip to API.

Thank you!
Eventually, my issue was resolved :slight_smile:
More than a month passed but we did it.
Please add all these details to the docs to save time for other developers.

Glad to hear it!

I agree this took quite some time, apologies for the back and forth. On a happy note, the work to edit the documentation for this part has already begun. It’s currently just waiting for some more technical details to be confirmed and once it’s done, it’ll be published.

In any case, feel free to reach out in case of more issues.