You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The client library is unusable within Web Workers, which are useful for asynchronous I/O operations like fetching and processing external data and loading/running WASM modules or other libraries that may need to be isolated in a separate thread, allowing the main UI thread to remain responsive.
The cause appears to be that window.ddClient is required by the client library but only injected into the main UI thread, and not in Web Worker threads.
The fix would likely be to inject a ddClient into every Web Worker thread's environment, in addition to the main UI thread.
Attempted Workarounds
Transferring the ddClient object into the Web Worker with the postMessagetransfer param - fails with not transferrable error.
Repro
Create new extension
docker extension init MyExtension
Create a Web Worker that attempts to import and use client MyExtension/ui/src/webWorker.js
import {createDockerDesktopClient} from '@docker/extension-api-client';
const client = createDockerDesktopClient()
Append Worker initialization to index.js MyExtension/ui/src/index.js
I realize this will probably need to be fixed in Docker Desktop, not here in the SDK, but I wasn't sure where to file the issue where it would be most easily tracked.
Summary
The client library is unusable within Web Workers, which are useful for asynchronous I/O operations like fetching and processing external data and loading/running WASM modules or other libraries that may need to be isolated in a separate thread, allowing the main UI thread to remain responsive.
The cause appears to be that
window.ddClient
is required by the client library but only injected into the main UI thread, and not in Web Worker threads.The fix would likely be to inject a
ddClient
into every Web Worker thread's environment, in addition to the main UI thread.Attempted Workarounds
ddClient
object into the Web Worker with thepostMessage
transfer param - fails withnot transferrable
error.Repro
Create new extension
Create a Web Worker that attempts to import and use client
MyExtension/ui/src/webWorker.js
Append Worker initialization to
index.js
MyExtension/ui/src/index.js
Install extension with debug window
Navigate to extension in Docker Desktop and see error in Debug Console
The text was updated successfully, but these errors were encountered: