baml icon indicating copy to clipboard operation
baml copied to clipboard

Not able to use baml playground in cursor (a vscode based port) when attached to a container.

Open kartikarcot opened this issue 5 months ago • 3 comments

When I run it outside the container it works fine.

The most relevant part of the error is:

Failed to fetch\n    at __wbg_fetch_1e4e8ed1f64c7e28 (https://vscode-remote+attached-002dcontainer-002b7b22636f6e7461696e65724e616d65223a222f73646576222c2273657474696e6773223a7b22636f6e74657874223a226465736b746f702d6c696e7578227d7d.vscode-resource.vscode-cdn.net/home/swastiks/.cursor-server/extensions/boundary.baml-extension-0.54.1/web-panel/dist/assets/baml_schema_build.js:2652:17)\n

The full stack trace is as follows:

Unspecified error code: 2
reqwest::Error { kind: Request, source: "JsValue(TypeError: Failed to fetch\nTypeError: Failed to fetch\n    at __wbg_fetch_1e4e8ed1f64c7e28 (https://vscode-remote+attached-002dcontainer-002b7b22636f6e7461696e65724e616d65223a222f73646576222c2273657474696e6773223a7b22636f6e74657874223a226465736b746f702d6c696e7578227d7d.vscode-resource.vscode-cdn.net/home/swastiks/.cursor-server/extensions/boundary.baml-extension-0.54.1/web-panel/dist/assets/baml_schema_build.js:2652:17)\n    at baml_schema_build.wasm.reqwest::wasm::client::js_fetch::hf2347d1bf26136c1 (wasm://wasm/baml_schema_build.wasm-025217fe:wasm-function[6915]:0x62a7e2)\n    at baml_schema_build.wasm.reqwest::wasm::client::fetch::{{closure}}::h0b3d38c2abdddd4b (wasm://wasm/baml_schema_build.wasm-025217fe:wasm-function[361]:0x1a756e)\n    at baml_schema_build.wasm.<baml_runtime::internal::llm_client::primitive::openai::openai_client::OpenAIClient as baml_runtime::internal::llm_client::traits::chat::WithStreamChat>::stream_chat::{{closure}}::h55e4e603b3fd1073 (wasm://wasm/baml_schema_build.wasm-025217fe:wasm-function[388]:0x1bffeb)\n    at baml_schema_build.wasm.baml_runtime::BamlRuntime::run_test::{{closure}}::h9af3ee7ff5cf3c9d (wasm://wasm/baml_schema_build.wasm-025217fe:wasm-function[138]:0x2f4ff)\n    at baml_schema_build.wasm.wasm_bindgen_futures::future_to_promise::{{closure}}::{{closure}}::h4dde7c5694323352 (wasm://wasm/baml_schema_build.wasm-025217fe:wasm-function[633]:0x268a07)\n    at baml_schema_build.wasm.wasm_bindgen_futures::queue::Queue::new::{{closure}}::hf2461b6851b74a5c (wasm://wasm/baml_schema_build.wasm-025217fe:wasm-function[3395]:0x511d39)\n    at baml_schema_build.wasm.<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h14c00d9e7eb5380f (wasm://wasm/baml_schema_build.wasm-025217fe:wasm-function[12674]:0x6b7326)\n    at __wbg_adapter_41 (https://vscode-remote+attached-002dcontainer-002b7b22636f6e7461696e65724e616d65223a222f73646576222c2273657474696e6773223a7b22636f6e74657874223a226465736b746f702d6c696e7578227d7d.vscode-resource.vscode-cdn.net/home/swastiks/.cursor-server/extensions/boundary.baml-extension-0.54.1/web-panel/dist/assets/baml_schema_build.js:240:12)\n    at real (https://vscode-remote+attached-002dcontainer-002b7b22636f6e7461696e65724e616d65223a222f73646576222c2273657474696e6773223a7b22636f6e74657874223a226465736b746f702d6c696e7578227d7d.vscode-resource.vscode-cdn.net/home/swastiks/.cursor-server/extensions/boundary.baml-extension-0.54.1/web-panel/dist/assets/baml_schema_build.js:222:16))" }

Check the webview network tab for more details. Command Palette -> Open webview developer tools. 

Some other points to note:

  • I build my docker container with network mode set to "bridge" so it has internet access from local machine.
  • When I open vscode and playground running outside the container it works
  • Another interesting and reproducible point of note is if two windows of vscode with playground running (one in container and one out of container), it works on both. So there is some kind of weird connection between the playgrounds when both windows are opened?
  • Interestingly the openai key which i had entered into the playground when vscode was opened from inside the container magically appeared in the playground when opened outside the container as well

kartikarcot avatar Sep 06 '24 09:09 kartikarcot