op-vscode icon indicating copy to clipboard operation
op-vscode copied to clipboard

Extension v1.0.0 '1Password: Get from 1Password' resulted in an error (Cannot read properties of undefined (reading 'kind'))

Open petercrocker opened this issue 3 years ago • 13 comments

Your environment

op-vscode version: v1.0.0 1Password for Mac 8.8.0 VS Code version: Version: 1.68.1 (Universal) CLI version: 2.5.1 OS: macOS 12.4 (21F79)

Steps to reproduce

  1. Cursor on a given line in VS Code2.
  2. CMD-Shift-P
  3. --> 1Password: Get from 1password
  4. Type name of 1password Login item: "Backblaze" (with first capital, exactly as in 1password
  5. 1password app on macOS gives prompt: "1Password is trying to authorize CLI access to your account “<my_vault_name>” in “Code”
  6. Clicked the "Accept" button
  7. I get the dialog box in VS Code: "Command '1Password: Get from 1Password' resulted in an error (Cannot read properties of undefined (reading 'kind'))"

Note I've completely restarted VS Code and 1password, and 1password helper extension before reproducing this again.

What happened?

Command '1Password: Get from 1Password' resulted in an error (Cannot read properties of undefined (reading 'kind'))

What did you expect to happen?

op:// string should have been pasted in to the line in VS code

Notes & Logs

From ~/Library/Application\ Support/Code/logs/20220624T123025/exthost1/exthost.log

[2022-06-24 12:30:26.676] [exthost] [info] Extension host with pid 73539 started [2022-06-24 12:30:26.676] [exthost] [info] Skipping acquiring lock for /Users/pete/Library/Application Support/Code/User/workspaceStorage/5664e5b984fa2711b279ab81a4de5fd7. [2022-06-24 12:30:26.707] [exthost] [info] ExtensionService#_doActivateExtension GrapeCity.gc-excelviewer, startup: false, activationEvent: 'onLanguage:plaintext' [2022-06-24 12:30:26.711] [exthost] [info] ExtensionService#_doActivateExtension ms-python.python, startup: false, activationEvent: 'onLanguage:ansible', root cause: redhat.ansible [2022-06-24 12:30:26.754] [exthost] [info] ExtensionService#_doActivateExtension redhat.vscode-yaml, startup: false, activationEvent: 'onLanguage:ansible', root cause: redhat.ansible [2022-06-24 12:30:26.783] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft' [2022-06-24 12:30:26.799] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: true, activationEvent: '' [2022-06-24 12:30:26.802] [exthost] [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '', root cause: vscode.git [2022-06-24 12:30:26.804] [exthost] [info] ExtensionService#_doActivateExtension vscode.ipynb, startup: true, activationEvent: '' [2022-06-24 12:30:26.807] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: true, activationEvent: '', root cause: GitHub.vscode-pull-request-github [2022-06-24 12:30:26.816] [exthost] [info] ExtensionService#_doActivateExtension oderwat.indent-rainbow, startup: true, activationEvent: '' [2022-06-24 12:30:26.836] [exthost] [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '' [2022-06-24 12:30:26.850] [exthost] [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '' [2022-06-24 12:30:26.853] [exthost] [info] ExtensionService#_doActivateExtension GitHub.vscode-pull-request-github, startup: true, activationEvent: '' [2022-06-24 12:30:26.958] [exthost] [info] ExtensionService#_doActivateExtension redhat.ansible, startup: false, activationEvent: 'onLanguage:ansible' [2022-06-24 12:30:26.985] [exthost] [warning] [redhat.vscode-yaml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[yaml]', provide the URI of a resource or 'null' for any resource. [2022-06-24 12:30:26.985] [exthost] [warning] [redhat.vscode-yaml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[yaml]', provide the URI of a resource or 'null' for any resource. [2022-06-24 12:30:27.095] [exthost] [warning] [redhat.vscode-yaml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[yaml]', provide the URI of a resource or 'null' for any resource. [2022-06-24 12:30:27.136] [exthost] [info] Eager extensions activated [2022-06-24 12:30:27.138] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.142] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.143] [exthost] [info] ExtensionService#_doActivateExtension 1Password.op-vscode, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.146] [exthost] [info] ExtensionService#_doActivateExtension aaron-bond.better-comments, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.157] [exthost] [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.171] [exthost] [info] ExtensionService#_doActivateExtension esbenp.prettier-vscode, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.191] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.205] [exthost] [info] ExtensionService#_doActivateExtension PascalReitermann93.vscode-yaml-sort, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.250] [exthost] [info] ExtensionService#_doActivateExtension PKief.material-icon-theme, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.255] [exthost] [info] ExtensionService#_doActivateExtension sourcery.sourcery, startup: false, activationEvent: 'onStartupFinished' [2022-06-24 12:30:27.311] [exthost] [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc' [2022-06-24 12:30:27.312] [exthost] [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc' [2022-06-24 12:30:27.319] [exthost] [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc' [2022-06-24 12:30:55.046] [exthost] [error] TypeError: Cannot read properties of undefined (reading 'kind') at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:206465 at processTicksAndRejections (node:internal/process/task_queues:96:5) op-vscode.getValueFromItem {"value":"1Password.op-vscode","_lower":"1password.op-vscode"} [2022-06-24 13:33:09.970] [exthost] [warning] TextEditor is closed/disposed [2022-06-24 13:40:15.948] [exthost] [error] TypeError: Cannot read properties of undefined (reading 'kind') at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:206465 at processTicksAndRejections (node:internal/process/task_queues:96:5) op-vscode.getValueFromItem {"value":"1Password.op-vscode","_lower":"1password.op-vscode"}

petercrocker avatar Jun 24 '22 12:06 petercrocker

Hey @petercrocker thanks for the detailed issue (and the kind words 😄)! I'll dig into this a bit to see what it could be. It looks related to #1, which was seemingly resolved by another tweak I made, but maybe it was just a fluke. I'll see what I can find!

jodyheavener avatar Jun 24 '22 13:06 jodyheavener

Thanks @jodyheavener I saw https://github.com/1Password/op-vscode/issues/1 but seemed to indicate it was fixed in op-vscode v0.1.2 hence submitting this since I'm on the 1.0 later version now. Happy to help debug further, let me know what would be useful.

petercrocker avatar Jun 24 '22 13:06 petercrocker

@petercrocker Just a heads up, I deleted the screenshot comment because the last field in it was partially unmasked. To be extra safe you might consider rotating that value.

jodyheavener avatar Jun 24 '22 13:06 jodyheavener

doh! thanks, will do!

petercrocker avatar Jun 24 '22 13:06 petercrocker

Hey @petercrocker I'm still trying to track down this issue, so I wanted to check to 1) see if this issue continues to persist with this specific item, or all items, 2) are you using 1Password CLI with biometric unlock fully set up? I see you noted that when authorizing you're asked to "Accept", which I believe comes from when you're using the CLI in clamshell mode (We still shouldn't see this issue but wanted to clarify)

jodyheavener avatar Jul 08 '22 14:07 jodyheavener

Hi @jodyheavener just tested again:

  1. Issue persists with that specific item only. That item has more complexity in it for sure. It's got sections defined, which seems to be the only unique thing about that item. Maybe that could be worth testing?
  2. Yes biometric unlock is fully setup, but as you allude to, i'm using it in clamshell mode when it's on my desktop plugged in to a thunderbolt dock.

That said, I've duplicated the item in question, and I've been removing content. Removed the sections, removed the OTP, yet it's still complaining each time with the error. It's only got a user and pw defined now! Don't know what's unique about that item, but the vs code extension clearly doesn't like it!

If you can tell me where/how to get debugging info, or run vs code extension in debug mode, happy to help!

petercrocker avatar Jul 08 '22 17:07 petercrocker

Hey @petercrocker, it's been a while, and I haven't been able to narrow down this specific issue, but I wanted to check in to see if you were still able to reproduce it.

If you can tell me where/how to get debugging info, or run vs code extension in debug mode, happy to help!

Currently the extension avoids logging anything like CLI output to prevent accidentally writing sensitive details to disk, so it's sort of a shot in the dark with certain issues, unfortunately.

jodyheavener avatar Oct 19 '22 17:10 jodyheavener

Hey @jodyheavener thanks for bringing this up again! Ok, so I tried a few things. I think I've narrowed it down, but not sure exactly what it's hanging on. Running op on the items it's barfing on show metadata that I can't see in 1password UI, so can't edit and remove, but seem to be the unique thing about the vault item. I've obfuscated the output a bit:

op item get Item2
ID:          mdwf5tsxxfbobgiftxxzidblah
Title:       Item2
Vault:       MyVault (u6temkdqebd6zccajlzzdkblah)
Created:     3 years ago
Updated:     35 seconds ago by Me
Favorite:    false
Version:     7
Category:    LOGIN
Fields:
  password:             removed!!
  :                     Toggle navigation
  username:             [email protected]
  password:             mypassword
  :                     Sign Up for MySite
  region:               eu-central
  :                     Modal Test
  :                     ×
  :                     Skip Quick
  :                     ×
  :                     Take Me To My Account
  one-time password:    123456
URLs:
  website:    https://somesite.com (primary)

So it's this section I don't see in the UI:

:                     Sign Up for MySite
  region:               eu-central
  :                     Modal Test
  :                     ×
  :                     Skip Quick
  :                     ×
  :                     Take Me To My Account

And if I create a new vault entry from scratch, with just user/pw then of course the metadata isn't in there, and the VScode extension works fine!

As a reminder, this is the error the 1p extension kicks out when trying to reference this: Command '1Password: Get from 1Password' resulted in an error (Cannot read properties of undefined (reading 'kind'))

Could that help?

petercrocker avatar Oct 20 '22 20:10 petercrocker

Hi,

I get the same error with :

  • op-vscode version: v1.0.2
  • 1Password for Mac 8.9.7 (80907031)
  • VS Code version: Version: 1.72.2 (Universal)
  • CLI version: 2.7.2
  • OS: macOS 12.6 (21G115)

Did you find how to solve that ?

tkelkermans avatar Oct 25 '22 11:10 tkelkermans

the format from get from 1password is wrong. It shouldn't include section in output.

image

maxisam avatar Dec 07 '22 18:12 maxisam

Hi @maxisam, thanks for your comment. I think you may be talking about a separate issue, though I can tell you that the extension does construct the secret references; they come directly from the CLI. You might consider opening a post on the CLI forums.

@petercrocker et al, I'm sorry I haven't been able to nail down this issue yet, but it's not been forgotten!

jodyheavener avatar Dec 09 '22 19:12 jodyheavener

This issue is still ongoing and we don't yet have a solution, so I'm going to open this up to Hacktoberfest submissions if anyone is brave enough or has any wild ideas. Good luck!

jodyheavener avatar Oct 03 '23 22:10 jodyheavener