无法将使用 mapbox-gl-native 库的函数部署到 Azure

Cannot deploy function that makes use of mapbox-gl-native library to Azure

当我尝试部署使用 mapbox-gl-native 库的 Azure 函数时,我在日志中收到此错误:

Stack: Error: \?\D:\home\site\wwwroot\node_modules\@mapbox\mapbox-gl-native\lib\node-v64\mbgl.node is not a valid Win32 application.

注意:我通常按照此处的说明进行部署:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli?tabs=bash%2Cbrowser&pivots=programming-language-javascript

我检查了 mapbox-gl-native 模块,发现它由矢量切片和 OpenGL 提供支持。这是问题所在,由于 GDI sandbox restrictions(GDI - openGL 所依赖的),您将无法使用此模块。

您可以在此处参考更多信息:Win32k.sys (User32/GDI32) Restrictions