Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with Sharp in Azure functions

Hi I have been trying to deploy my code for resizing image streams in azure function. It seems to be working perfectly fine in local, even deployment via VS code is successful. But when I try to trigger the function, I get below exception.

Relatively new to both nodejs and azure, any suggestions?

2021-06-08T04:51:24.370 [Information] Executing 'Functions.HttpTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=7bd3aba0-8833-4ffe-b2c7-a061533fef6a)
2021-06-08T04:51:24.444 [Error] Executed 'Functions.HttpTrigger1' (Failed, Id=7bd3aba0-8833-4ffe-b2c7-a061533fef6a, Duration=17ms)
Result: Failure
Exception: Worker was unable to load function HttpTrigger1: 'Error: 'win32-x64' binaries cannot be used on the 'win32-ia32' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'win32-ia32' platform.'
Stack: Error: 'win32-x64' binaries cannot be used on the 'win32-ia32' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'win32-ia32' platform.
    at Object.hasVendoredLibvips (C:\home\site\wwwroot\node_modules\sharp\lib\libvips.js:82:13)
    at Object.<anonymous> (C:\home\site\wwwroot\node_modules\sharp\lib\constructor.js:7:22)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\home\site\wwwroot\node_modules\sharp\lib\index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
like image 838
SUBHANGI KARAN Avatar asked Apr 01 '26 15:04

SUBHANGI KARAN


1 Answers

According to the error message, we need to update Azure function as 64 bit Platform. Regarding how to do that, please refer to here.

enter image description here

like image 123
Jim Xu Avatar answered Apr 04 '26 07:04

Jim Xu