Node.js Client TypeError [ERR_INVALID_URL]: Invalid URL

Hello, I am trying to deploy a 1Password Connect Server via Docker as per your instructions but, I am getting the following error whenever I run the nodejs app code.

Please, could you help me?

P.S.: Regarding the myVaultId shown in the URL below, I am using the vault id of the vault I gave permission to the integration server. I managed to get the vault id via 1Password CLI. it is a string with twenty-six characters.

TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:363:5)
    at onParseError (node:internal/url:536:9)
    at new URL (node:internal/url:612:5)
    at RequestAdapter.normalizeURL (D:\Downloads\nodejs\1Password-Secret-Automation\node_modules\@1password\connect\dist\lib\requests.js:56:41)
    at RequestAdapter.<anonymous> (D:\Downloads\nodejs\1Password-Secret-Automation\node_modules\@1password\connect\dist\lib\requests.js:45:53)
    at (<anonymous>)
    at D:\Downloads\nodejs\1Password-Secret-Automation\node_modules\@1password\connect\dist\lib\requests.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (D:\Downloads\nodejs\1Password-Secret-Automation\node_modules\@1password\connect\dist\lib\requests.js:4:12)
    at RequestAdapter.sendRequest (D:\Downloads\nodejs\1Password-Secret-Automation\node_modules\@1password\connect\dist\lib\requests.js:39:16) {
  input: 'v1/vaults/myVaultId/items/',
  code: 'ERR_INVALID_URL'"

1Password Version: 7.7.810
Extension Version: Not Provided
OS Version: Microsoft Windows 10.0.19043.1081
Sync Type: Not Provided


  • David_agDavid_ag

    Team Member
    edited June 30

    Hi @fbi ! That's definitely frustrating, so thank you for reporting this issue.

    It looks like the module isn't able to parse the server URL you provided when initializing the SDK:

    import { OnePasswordConnect } from "@1password/connect";
    const op = OnePasswordConnect({
        serverURL: "http://localhost:8080", // this needs to be a valid URL with http:// or https:// 
        token: "my-token"

    Could you confirm that the serverURL argument is a valid URL?

    I was able to reproduce the issue with this test script:

    # example.js
    const {OnePasswordConnect} = require("@1password/connect");
    const op = OnePasswordConnect({serverURL: "anInvalidUrl", token: "example"});
    # TypeError [ERR_INVALID_URL]: Invalid URL: anInvalidUrl
  • fbifbi

    Hello @David_ag. Thanks for the reply. Apparently, the issue is related to the Microsoft Windows environment. I use the Docker Desktop app on my Windows 10 running Linux containers on my initial try. On this occasion, I received an invalid URL error. Although as soon as I tried the same files on my Mac, everything worked fine. So far, I am happy that I managed to see the vanilla code working, but I need to have it on the Windows environment as this is where the project will be deployed. Please, would you be able to guide me on how to set up the 1Password Secrets Automation on Windows?

  • David_agDavid_ag

    Team Member

    Could you provide an example of how you're passing the server URL to the OnePasswordConnect function? Are you using environment variables or some other method?

  • fbifbi

    Yes, I am passing it via a Windows environment variable. In reality, I am passing these variables (OP_CONNECT_HOST, OP_CONNECT_TOKEN, OP_VAULT, SECRET_STRING) as system environment variables.

  • David_agDavid_ag

    Team Member

    Thanks for the information!

    It sounds like either the Windows environment variable is never set or there's a formatting issue with the environment variable. Have you tried doing a console.log() to print the OP_CONNECT_HOST variable in your script or app before you pass it to the Connect SDK instance?

    The log statement would help isolate whether Node is unable to read the environment variables in Windows or if some other process is modifying the OP_CONNECT_HOST environment variable you're setting.

  • fbifbi
    edited July 5

    Hello David_ag. Thanks for the support. I followed your advice, and the script printed the environment variables values correctly before it tries to connect to the SKD instance. However, the same error persists to happen.

    Edit: Apparently, I found the problem related to this code: 'ERR_INVALID_URL'. For the OP_CONNECT_HOST environment variable, I have been using localhost:8080, however, as soon as I added the http:// to the URL, it seems that the error is gone. Sorry for the drama, David_ag

  • James_1PJames_1P

    Team Member

    Thanks so much for following up and sharing your solution. Please feel free to open an issue in the JS SDK to improve the error messaging in this case.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file