Hi, I’m new to n8n and I’m trying to use multiple NPM packages on a code block.
I have an Azure web app where I deploy my n8n instance, I’m using the image
docker.n8n.io/n8nio/n8n:latest
I added the NODE_FUNCTION_ALLOW_BUILTIN=* and NODE_FUNCTION_ALLOW_EXTERNAL=@azure/identity,@azure/arm-subscriptions to the web app environment variables and restart the web app. But after that the code is still failing: Cannot find module ‘@azure**/arm-subscriptions’ [line 1]**
Does anybody has tried to do this? and how could you solve this?
Appreciate all input! Thanks
Code block:
const { SubscriptionClient } = require("@azure/arm-subscriptions");
const { ClientSecretCredential } = require("@azure/identity");
//Get subscriptions
async function getSubscriptions(credentials) {
try {
const client = new SubscriptionClient(credentials);
for await (const subscription of client.subscriptions.list()) {
console.log(` Display Name: ${subscription.displayName}`);
console.log(` Subscription ID: ${subscription.subscriptionId}`);
console.log(` State: ${subscription.state}`);
console.log("---");
}
} catch (error) {
console.log("Error listing subscriptions:", error);
}
}
const tenantId = "TENANT-ID";
const clientId = "CLIENT-ID";
const clientSecret = "CLIENT-SECRET-ID";
const credentials = new ClientSecretCredential(
tenantId,
clientId,
clientSecret,
);
getSubscriptions(credentials);