Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: connect ECONNREFUSED ::1:8080 when connecting to the OnePassword Connect server #112

Open
skoblenick opened this issue Dec 30, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@skoblenick
Copy link

Your environment

SDK Version: 1.4.1

Connect Server Version: 1.7.2

OS: MacOS 11.7.9 (Big Sur - Intel) with Rancher Desktop and Docker

Node Version: v18.18.2

What happened?

Using the serverURL of http://localhost:8080 attempts to resolve via IPv6 and fails to resolve the host causing the connection to the op-connect-api container to fail when running in local development. Using Rancher Desktop & Docker.

What did you expect to happen?

No error connecting to the op-connect-api Docker Container and a list of vault/secrets to be returned.

Steps to reproduce

  1. Create a Secrets Automation save the .json and token.

  2. Setup OnePassword Connect server per https://developer.1password.com/docs/connect/get-started/#step-2-deploy-1password-connect-server with Rancher Desktop and Docker.

    • Verify connection returns values with:
         curl \
           -H "Accept: application/json" \
           -H "Authorization: Bearer $OP_API_TOKEN" \
           http://localhost:8080/v1/vaults
    
  3. Create a basic test.ts file with:

    import { OnePasswordConnect, Vault } from '@1password/connect';
    
    export async function getSecrets(): Promise<Vault[]> {
      try {
        const op = OnePasswordConnect({
          serverURL: 'http://localhost:8080',
          token: 'my-token',
          keepAlive: true,
        });
    
        return await op.listVaults();
      } catch (err) {
        return Promise.reject(err);
      }
    }
    
    async function main() {
      console.log('vaults:', await getSecrets());
    }
    
    main();
  4. run the file with ts-node ./test.ts, which results in:

        cause: Error: connect ECONNREFUSED ::1:8080
        at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
          errno: -61,
          code: 'ECONNREFUSED',
          syscall: 'connect',
          address: '::1',
          port: 8080
        }
    
  5. Changing serverURL to http://127.0.0.1:8080 and rerunning the script then works as expected; returning a list of vaults.

@skoblenick skoblenick added the bug Something isn't working label Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant