Hi there! When trying to use v12 on localhost with a OIC license key I get an invalid url error. Am I missing something or is the license key not valid for use on localhost?
8 Answers
8I had that too. You have to set this in your environment variables:
PUBLIC_URL: http://localhost:8055
Even though it’s not actually public, it still needs it for the license to work.
Hi Mark! I had actually set the PUBLIC_URL to http://localhost:8055 but even so I get the invalid url error message. Did you do a “clean install” or an upgrade from a previous Directus version?
Hmm okay that must be a different thing then. Checking my notes, the error I had was “public_url must be a valid absolute URL”.
I did an upgrade from v11.
Sounds like its a different error yes. For me the console outputs:
FATAL: Unable to validate the LICENSE_KEY, please check the key and try again.
FATAL: Invalid URL
Hey @Magnus, sorry to hear you’re having troubles here, firstly, have you copied the license key over accurately? Have you checked your settings against the license key docs?
Hi Beth! Yes, I´ve made sure to copy the exact key and set the public_url. But when thinking about it, on first use I had set the public_url to http://10.0.0.2:8055 instead of localhost and according to the docs “On first use, it binds your license to a specific project and PUBLIC_URL.” May it be that the 10.0.0.2 instead of localhost is the culprit? I´ve try to set the public_url to http://localhost:8055 but it always triggers the same error.
Hi James! Im running a local node in development mode ( pnpm --filter api dev ) This is also logged to console: ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @directus/api@36.0.2 dev: NODE_ENV=development SERVE_APP=true tsx watch --ignore extensions --clear-screen=false src/start.ts
Hi @Magnus - confirmed then: you're using a production license key in dev mode. pnpm --filter api dev hardcodes NODE_ENV=development. So your options are: 1. Run the official Docker image (prod mode by default) — add your LICENSE_KEY in the env. There is an example docker compose here - https://directus.com/docs/getting-started/create-a-project#docker-compose 2. From source: pnpm --filter api build, then cd api && NODE_ENV=production SERVE_APP=true node dist/start.js Docker is the smoother path for a licensed setup, but the source option should get you up and running too.
Awesome, that solved the issue, thanks a lot James! ![]()
Glad to be of help - I will update the docs as this could be clearer on our side. Thank you!
– James_White
Hi @Magnus - even if you previously set a different PUBLIC_URL, the OIG keys allow up to 5 distinct activations - meaning, if you updated the PUBLIC_URL and restarted the container it should create a new binding. One idea - how are you running Directus (Docker image, local Node, something else)? The exact Invalid URL message you're seeing usually isn't about PUBLIC_URL at all - it tends to show up when NODE_ENV is set to development, which routes the license check to the wrong endpoint and throws that error before your key is ever checked. Could you check whether NODE_ENV=development is set?
– James_White