Search code examples
javascriptnode.jsgoogle-cloud-platformgoogle-secret-manager

GCP SecretManager DEADLINE_EXCEEDED error code 4


Since I've changed my Internet Provider, I can no longer get access to GCP SecretManager values. It tooks 10 minutes (60000 miliseconds) to get a timeout response. I tried to reduce it with optional argument but it won't work, it's ignored. Am I doing something wrong ?

enter image description here

It works fine inside the Docker by the way, on the same machine.

My environment is: Windows 10, Using WSL2 Ubuntu 20.04 version.

Here is the code:

  const { SecretManagerServiceClient } = require('@google-cloud/secret-manager')

  process.env.PROJECT_ID = 'nameOfTheProject'

  module.exports = async (secret, project) => {
    const projectId = project || process.env.PROJECT_ID

    try {
      const client = new SecretManagerServiceClient()

      const [accessResponse] = await client.accessSecretVersion({
        name: `projects/${projectId}/secrets/${secret}/versions/latest`
      }, {
        timeout: 3000, // <--- this line is ignored somehow
        maxRetries: 0
      })

      return accessResponse.payload.data.toString('utf8')
    } catch (error) {
      console.error('🐞 service.secrets failed:', error.message)
      return error
    }
  }

Solution

  • I've solved the problem.

    I'm using Windows 10 with WSL2 (ubuntu 20.04). I had a problem with internet connection within that WSL2 Ubuntu 20.04 container. I'm not sure where does this problem came from but I've changed my Internet Provider and the problem occured.

    1. I've checked internet connection by ping www.google.com (internet doesn't worked)
    2. I've flushed DNS ipconfig /flushdns inside WSL2 Ubuntu 20.04 container.
    3. Retried ping www.google.com and suddenly it started to work.

    Problem came from Network Issues with WSL2 image.