Azure Functions - Import Custom Node Module

Viewed 1396

I'm experimenting with Azure Functions. I'm trying to use a third-party Node module in my function. However, I've been unable to figure out how to import it.

{
  "id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "requestId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "statusCode": 500,
  "errorCode": 0,
  "messsage": "Exception while executing function: Functions.analyze -> Error: Cannot find module 'moment'\n    at Function.Module._resolveFilename .."
}

I'm just trying to import the moment.js Node library. I was unable to find any documentation around this scenario though.

Does anyone know how to import a third-party module into Azure Functions?

2 Answers

This is now out of date. Instead, go to Advanced Tools (Kudo) -> Bash -> cd site/wwwroot -> npm i package

Related