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: error:0480006C:PEM routines::no start line #1938

Open
evgeniy-kolmak opened this issue Dec 22, 2024 · 1 comment
Open

Error: error:0480006C:PEM routines::no start line #1938

evgeniy-kolmak opened this issue Dec 22, 2024 · 1 comment

Comments

@evgeniy-kolmak
Copy link

I'm trying to connect from the application ...

class RedisService {
  private readonly redis: Redis;
  constructor() {
    const password = process.env.REDIS_PASSWORD ?? '';
    this.redis = new Redis({
      host: 'redis',
      port: 6379,
      tls: {
        ca: './certs/ca.pem',
        cert: './certs/client-cert.pem',
        key: './certs/client-key.pem',
      },
      password,
    });

    this.redis.on(
      'error',
      console.error.bind(console, 'Error connecting to Redis:'),
    );
}

I get this answer...

Error: error:0480006C:PEM routines::no start line
    at node:internal/tls/secure-context:70:13
    at Array.forEach (<anonymous>)
    at setCerts (node:internal/tls/secure-context:68:3)
    at configSecureContext (node:internal/tls/secure-context:191:5)
    at Object.createSecureContext (node:_tls_common:114:3)
    at connect (node:_tls_wrap:1764:48)
    at /usr/src/app/node_modules/ioredis/built/connectors/StandaloneConnector.js:51:57
    at processTicksAndRejections (node:internal/process/task_queues:85:11) {
  library: 'PEM routines',
  reason: 'no start line',
  code: 'ERR_OSSL_PEM_NO_START_LINE'
}

The Redis server is up in docker. The certificates are valid, I connected using them via an extension in VScode.

@evgeniy-kolmak
Copy link
Author

evgeniy-kolmak commented Dec 24, 2024

it works

tls: {
        ca: readFileSync('certs/ca.pem'),
        cert: readFileSync('certs/client-cert.pem'),
        key: readFileSync('certs/client-key.pem'),
        rejectUnauthorized: false,
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant