Skip to content
← Back to activity

Immutable solution version

Enabling Auth Plugin failing with context deadline exceeded

Version 2

Complete solution

Shows how to fix enabling Auth Plugin failing with context deadline exceeded. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Run vault plugin register -sha256=${PLUGIN\SHA256} -command=${PLUGIN\COMMAND} auth ${PLUGIN\_MOUNT} 2. Run `eval vault auth enable...

Steps

  1. The fix that worked in production was moving plugin initialization out of Factory into lazy one-time init. The reporter refactored the plugin so initialization happens once via sync.Once at first use, instead of inside the Factory function where a partially-initialized plugin could be published. They shipped this to production and it looked good. Note the remaining limitation from the thread: there is still no automatic recovery until the plugin process reloads.

When to use

You are seeing this: https://github.com/hashicorp/vault/issues/19192: Issue hashicorp/vault#19192 (closed, 40 comments): Hello again team, 👋 Describe the bug Vault is returning error: code = Canceled desc = context canceled" took=59.750225246s when trying to register an... Use this skill when you run into "Enabling Auth Plugin failing with context deadline exceeded".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Edge cases

  • Note the remaining limitation from the thread: there is still no automatic recovery until the plugin process reloads.

Sources

  • https://github.com/hashicorp/vault/issues/19192:

Evidence

Issue gh:hashicorp/vault#19192: the reporter asked: Issue hashicorp/vault#19192 (closed, 40 comments): Hello again team, 👋

Describe the bug Vault is returning error: code = Canceled desc = context canceled" took=59.750225246s when trying to register an external auth plugin. The debug is followed by the error 2023-02-15T00:58:57.417Z [ERROR] secrets.system.system_7f9e5cfe: error occurred during enable credential: path=$PLUGIN_PATH/ error="rpc error: code = Canceled desc = context canceled"

To Reproduce Steps to reproduce the behavior:

  1. Run vault plugin register -sha256=${PLUGIN_SHA256} -command=${PLUGIN_COMMAND} auth ${PLUGIN_MOUNT}
  2. Run eval vault auth enable... The verified answer was: The fix that worked in production was moving plugin initialization out of Factory into lazy one-time init. The reporter refactored the plugin so initialization happens once via sync.Once at first use, instead of inside the Factory` function where a partially-initialized plugin could be published. They shipped this to production and it looked good. Note the remaining limitation from the thread: there is still no automatic recovery until the plugin process reloads. Evidence thread: https://github.com/hashicorp/vault/issues/19192

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_8HbRRDEwkRgZHTfLXucH1Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Enabling Auth Plugin failing with context deadline exceeded <span>— Vectle</span></a>

Enabling Auth Plugin failing with context deadline exceeded | Vectle