Other people have done this before, of course. I'm not breaking new ground here.
Background picture
I know how to make a Lambda function in AWS. Amazon are wildly unfriendly with their TLAs but the first time I used it the whole thing took about an hour, and I wrote something that uses a webhook to forward some information to a different API. It was straightforward so far as I remember.
So why did I do this?
Microsoft stack for a different client. Needed to learn the ropes.
Let's do Azure!
$ign me up (tldr; issues: multiple, confidence: suspicious)
Step one is to get a free Azure account.
Well, I say free. You have to provide your credit/debit card details even if you want to use the free tier, which does not fill me with confidence.
Microsoft let me sign up with a GitHub account - a service they own - but apparently that's not enough to identify me, so I have to use my phone. Honestly, this tells me more about how much they trust their own other products than it does about Azure.
However, the process went without any technical glitches.
And you know something? I quite like their retro theme. Looks straight out of the early 2000s, like cPanel or sommat:
Installing prerequisites (tldr; issues: multiple, confidence: are we learning yet?)
There aren't any real prerequisites so far as the official documentation goes, except needing to install whatever language you choose. I'm going to go with TypeScript.
I'm also using VSCodium1 because I want to follow the tutorials and their VSCode examples seem the best documented. Full disclosure, I'm not a big GUI person; the only thing I have installed so far is the VSCode neovim extension and the Gruvbox theme so I feel comfortable.
I install the "Azure Functions" extension, and open their "http trigger" example function. I want something simple, like a "hello world" effort where I can visit a particular URL and get a canned response.
Looks good so far, syntax highlighting all works, tooltips show me Azure-related guff.
Apparently I can run this function locally. I hit "Run" to see what it does...
Oh. Ok, let's learn more, shall we?
I get taken to a web page telling me to install Azurite
. Cool. Would have been nice if this was a hard dependency of the AzureFunctions extension, or at least listed in the documentation before this point, but ok. We're here now. I'll do what you say, Microsoft Help Page, I'll install it as a VSCode extension.
Except that extension doesn't exist in the VSCode extensions search.
Hmm. Maybe VSCode isn't getting an up-to-date list of add-ons? I'll fall back to a web search.
Bingo!
So let's do that.
Boo.
Is it something I said?
Maybe it's because I told Microsoft's telemetry to get in the sea, and run VSCodium instead of VSCode? Perhaps a pre-requirement of running an Azure function is that they leech more of my personal data?
I'll install the Bad Place version of the IDE and see what difference that makes...
...it was something I said.
Hello, world? (tldr; issues: oodles, confidence: I don't know the meaning of the word)
It prompts me to sign in, so I do. Twice. Once for the Azure functions and then for the Azure functions, but on a page with a slightly different colourscheme.
I run "debug". It fails, and I read the documentation again. Ah, the Azurite extension doesn't start automatically, I have to run it manually every time. No biggie2.
It can't find the function in Azure. Tells me it doesn't exist.
Reading the issues tells me this is because I left it idle too long. Apparently an hour of debugging and getting more coffee is enough for this to silently log you out and prepare a misleading error message for when you return.
I log in again. In order to do that I have to quit and restart VSCode. Maybe there's a way to do it in the IDE, but I couldn't find it.
Hello Node my old friend, I've come to speak with you again.
Let's go!
[error] Incompatible Node.js version (v23.9.0). Refer to our documentation to see the Node.js versions supported by each version of Azure Functions: https://aka.ms/functions-node-versions
It seems Azure Functions currently max out at node version 20. That's not unusual for these sort of platform-specific things, Vercel, Netlify, AWS, etc., all have similar restrictions.
However.
I cannot find out how to get VSCode to use a different version of node. Various articles online tell me to set a runtimeVersion
in my launch.json
. This does nothing whatsoever, and as an added indicator of its relevance, the keyword "runtimeVersion" has that little yellow squiggle that means, as the Australians might say, "yeah, yeah, no."
If you're adventurous enough to follow that link, you might notice that it takes you to a page which says absolutely nothing about node versions.
If I navigate to their node troubleshooting page, the only relevant part I see is this:
Make sure you're using Node.js v18 or higher.
Maybe the problem is that 23 < 18 in Microsoft Units.
Other articles tell me to set the default in nvm to 20 - nvm alias default 20
. This does not help.
200mph solution incoming...
I "fix" this by closing VSCode and launching it from an environment where 20 is already the current version:
nvm use 20 && code
I don't particularly like this because if I launch the IDE from my desktop it'll fail and I might not remember why. Still, it's a way forward!
Conclusion
I made it? I think.
I can debug a local copy of an Azure function and instantly deploy it when I'm happy with my work. Now it's running, it's pretty smooth.
Cover image by Bing, based on artwork stolen from real humans.
Top comments (6)
Thank you for sharing so that I don’t have to go through this traumatic experience myself. I appreciate your sacrifice 🫡
Good explanation given
I love how node version hell brings you back to the 90's with flashbacks of DLL hell. en.wikipedia.org/wiki/DLL_hell
I thought it is only me who finds out that the Azure is gibberish. It is good to know that I'm not the only one.
I really like your writing style! It feels natural, straight to the point, and easy to read.
Hey thanks!