podman-desktop icon indicating copy to clipboard operation
podman-desktop copied to clipboard

Secure storage file for extension cannot be parsed (sometimes) due to be empty or to have an invalid JSON

Open dgolovin opened this issue 10 months ago • 0 comments

Bug description

I hit several errors when secure content of storage file:

  1. empty
  2. contains corrupt json like posted below
{}redhat.redhat-authentication.redhat-account-auth":"base64encodedtoken=="}

If secure storage parsing fails Podman Desktop window stays on loading image.

Operating system

macOS M1 Sonoma 14.3

Installation Method

Other

Version

next (development version)

Steps to reproduce

Hard to reproduce, but it it happened to me several times during development. Could be related to abnormal exit from podman desktop or killing when it hangs in debug session.

Relevant log output

3:48:38 PM [main] (node:97157) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected non-whitespace character after JSON at position 2 (line 1 column 3)
    at JSON.parse (<anonymous>)
    at SafeStorageRegistry.init (/Users/eskimo/Sources/podman-desktop/packages/main/dist/index.cjs:116669:23)
    at async PluginSystem.initExtensions (/Users/eskimo/Sources/podman-desktop/packages/main/dist/index.cjs:121395:5)
    at async /Users/eskimo/Sources/podman-desktop/packages/main/dist/index.cjs:123536:23

it maps to SaveStorageRegistry class init method line where json is loaded from file

const data = JSON.parse(content);

Additional context

No response

dgolovin avatar Apr 04 '24 23:04 dgolovin