Azure Function ES6 module support

redbird 1 Reputation point
2022-03-15T20:34:05.203+00:00

I have a triggered (by Service Bus) Azure Function (v4 with Node 14) which I can get to execute using standard Common JS module. But I need to use ES6 modules, this documentation makes it sound like all I need to do is change the index.js extension to index.mjs then change the wrapping function to use export, but this is not working for me, it's not executing.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=v2-v3-v4-export%2Cv2-v3-v4-done%2Cv2%2Cv2-log-custom-telemetry%2Cv2-accessing-request-and-response%2Cwindows-setting-the-node-version#ecmascript-modules

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,352 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,436 Reputation points
    2022-03-31T17:03:46.687+00:00

    @redbird ,

    Apologies for the delay in response.

    I would suggest you to try the steps specified in this forum as it is the same issue: https://social.msdn.microsoft.com/Forums/en-US/2d5c81df-9b74-4ada-ad2c-8c4b35d7e303/typescript-azure-function-how-to-solve-quotunable-to-determine-the-primary-function-scriptquot

    If this doesnt help, try creating a fresh function app project with the same code.

    0 comments No comments