Problem using builtin url module

Hey! I am trying to use url module in my function code, but get a error. I enabled env variable NODE_FUNCTION_ALLOW_BUILTIN=url (and tried to use * as well), but my simple code does not work. Any ideas how to fix it?

const urllib = require('url');
parsed_url = urllib.URL("http://asdasd.ru/?utm_source=1&utm_medium=2")
res = { json: { url: parsed_url }}
return [res]

What is the error message (if any)?

ERROR: Access denied to require 'url'

Please share the workflow

Information on your n8n setup

  • 0.151.0
  • PG
  • OWN
  • Docker

Hi @arrowcircle, I quickly tested this on my end, but url becomes available as expected when setting NODE_FUNCTION_ALLOW_BUILTIN=url. Is there a chance you didn’t recreate your docker container after changing the variable?

I restarted my container, not recreated. Is it possible docker-compose is not updating env variables?

My understanding is that you’d need to recreate the container in order to apply changes to for example the environment variables in your docker compose file. Something like docker compose up --force-recreate --detach should do the trick.

same error even after removing the container

so i found why it’s not working. With single argument, n8n does not handle values like

NODE_FUNCTION_ALLOW_BUILTIN="url"

and this works

NODE_FUNCTION_ALLOW_BUILTIN=url