-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support 64 bit NodeJS executable #158
Comments
It is really boring. I need to find an alternative to Azure Functions. Is there any update about this issue? |
Sorry for the delay. We don't fully support a 64 bit Node.js executable. However, we do have a workaround to "bring your own node executable" and then point to it. Bringing your own node.exe
Pointing to a custom node.exe
Again, this is a not ideal workaround, but let me know if you are not unblocked by this. |
Thank you for your answer. It is also required to switch Platform to 64-bit in Application Settings for this to work. |
@mhoeger I followed your instructions and loaded from a x64 node.exe. However, I am still getting the following error when loading the Sharp node module: Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.postProcessMedia ---> Microsoft.Azure.WebJobs.Script.Rpc.RpcException: Result: Failure |
|
I was not able to get past running |
Sadly while Git/CI npm install, a deprecated Node.js 6.x is called instead of your 64-bit node.exe. The only way is to upload a ZIP file containing your compiled prod dependencies to a blob container. This can be achieved with WEBSITE_RUN_FROM_PACKAGE app setting together with "bundledDependencies" and "files" properties in your package.json. |
@ahmelsayed - I'm guessing that choosing the bitness of node.exe will be much easier to support on the Linux offering. Is that right? |
I have to say this is extremely frustrating. IMHO, FaaS offerings should do their best to abstract away the underlying infrastructure. This issue lays bare the underlying infrastructure that Azure Functions is built on. Frankly, the underlying OS shouldn't matter to a developer building on a FaaS platform. I find it hard to understand how Azure Functions, a product that was first announced less than 3 years ago, would have an architecture that makes implementing support for a 64 bit platform so difficult. It's not like x64 support was yet to be implemented in Node for Windows. It has been supported since at least v4.0.0 released in September of 2015. Why is changing the bitness of the .NET runtime a simple toggle switch in the UI, but changing which NodeJS executable is used a Herculean effort? Is it not possible to have a different VM image to use that has Node x64 installed? And frankly, I would venture to guess that the vast majority of Windows-based developers are developing on machines that run Node x64, given that it is the default download on the NodeJS website: So for Azure Functions to run the 32 bit version of Node is a real problem for Node developers who run windows and deploy to Azure functions. I look forward to discussing this issue at the MVP Summit in a few weeks @eduardolaureano. |
@AshleyGrant - I am sorry about the frustrating experience. I think you are primarily asking for all functions to run on a 64 bit host and a 64 bit node.exe by default. We have changed the default on the Linux offering to run on 64 bit node (Linux consumption apps are currently in preview). It's a bit trickier for the Windows offering. To provide some context, the changes we made to have JavaScript code run directly on a Node.js process instead of through the Edge.js .NET library were pretty recent. With this, we've uncovered some gaps in the underlying infrastructure such as a lack of deployed 64 bit node executables on worker machines. Azure Functions relies on spare compute from App Service, and this is an App Service limitation that we have run into. I've started talking to @paulbatum about finding the appropriate owner to update the App Service machines with 64 bit node versions. It's a more niche scenario so they haven't heard all too much noise about it, but it is a change that's long overdue. Although our goal is abstraction, as you've said, I do hope you understand that getting to that point can require changes that have a broad scope and impacts beyond the immediate situation. The toggle not applying to node.exe is absolutely a gap in expectation / experience, and we appreciate your patience as we fix that. |
I'm not necessarily asking for all functions to run on a 64 bit host w/64 bit Node by default. I do think that 64 bit Node should be used when running on a 64 bit host, though. Thank you for the explanation of the underlying constraints. Hopefully this can be resolved sooner rather than later. Let's please keep this issue open until then, though. |
@AshleyGrant @ChrisSmith5 when using git deployment, you can install sharp by setting |
I've come up with a workaround that allows me to bring a custom Node executable along for the ride when I "build" my application using Azure Devops. I'm mostly using the strategy specified by @mhoeger, but distributing node.exe as part of my application zip file. Details here: https://aurelia.ninja/2019/04/04/a-strategy-for-deploying-a-custom-node-executable-to-azure-functions-on-windows/ |
@zavr-1 I've confirmed that your solution works, but I figure if I'm going far enough to include my own node executable in my demo code, I might as well use a CI/CD tool (Azure Devops in my case) to orchestrate the build. My solution also eliminates the need for manually copying |
@mhoeger should this still be open? It seems the two work items you mentioned needed closing to fix this are done? Or is Azure/Azure-Functions#1216 a dependency still? |
@nzthiago - It's almost out!! In its final form, we'll let people target 64-bit node by choosing to run their site as 64-bit AND setting |
Great - fully agree with not closing until it's done ;) Thank you for the update |
Update: rolling out this feature has been delayed. However, there is an easier temporary workaround. You can add the app setting Thanks for your patience all! |
@mhoeger -- I've set up a function all with the settings listed above. When I go the console and I have my setting as you mentioned above, platform set to 64 bit. Any idea what I might be missing? |
@krankin try setting |
@YannickRe -- 👍 That worked! |
@krankin - try doing process.arch from inside a function app, this is a bit hacky so it won't propagate to the kudu/scm/console environment. @YannickRe - never thought about that's an interesting workaround too! Clever! |
@mhoeger It's the only way I consistently get the 64-bit binaries across the platform (running the code, testing in the Kudu Console, when doing Kudu CI with deployment center, etc). Only difference is with the Looking forward to having it easier in the future ;) |
I get 64-bit in the function app and 32-bit in Kudu with the below:
Setting So, I do not need 64 bit default in Kudu, but it did confuse me for a long time, since I used Kudu to try to verify the architecture. But for all purposes the workaround from @mhoeger works for the function app. Thanks! |
Hi @mhoeger, thank you for the workaround! This appears to be exactly what I needed. Can we expect |
@emily-curry - yes, you can expect that to keep working going forward! It will be good to switch over to |
@YannickRe one of my devs was struggling with this today. It appears that |
Two updates to close this issue:
A few additional considerations if you are choosing between Windows vs. Linux:
|
This is very nice. Is there a way to set these platform settings via CLI when creating a function as well or doe we have to use the web UI for that? Was hoping to find something on https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings, but that is not the case. |
From @AshleyGrant on November 19, 2018 17:15
Switching to the 64 bit runtime does not switch to a 64 bit version of Node. Unfortunately, this causes issues as there are some NPM packages that only support running on 64 bit Node. One in particular is "sharp." This is an image manipulation library that is orders of magnitude faster than alternatives, but only supports running on 64 bit Node due to it calling to DLLs that are compiled to run on x64.
As it currently stands, Node developers have no way to utilize 64 bit Node on a consumption plan. Switching to the 64 bit Node executable when running the function app in 64 bit mode would solve this problem.
Copied from original issue: Azure/Azure-Functions#1041
We cannot deploy 64 bit nodejs and make breaking changes in underlying infrastructure of this behavior, especially because app service customers will be affected. However, we can introduce this change with the introduction of ~ targets for WEBSITE_NODE_DEFAULT_VERSION.
Involves:
The text was updated successfully, but these errors were encountered: