onlook icon indicating copy to clipboard operation
onlook copied to clipboard

[bug] bun dev command is stuck in an infinite restart loop!

Open Rish-it opened this issue 6 months ago • 2 comments

Describe the bug

@onlook/web-client dev:   5 |
│ @onlook/web-client dev: > 6 | const sdk = new FreestyleSandboxes({
│ @onlook/web-client dev:     |            ^
│ @onlook/web-client dev:   7 |     apiKey: env.FREESTYLE_API_KEY
│ @onlook/web-client dev:   8 | });
│ @onlook/web-client dev:   9 | {

I noticed that the FREESTYLE_API_KEY environment variable is marked as optional in the schema (z.string().optional()), but it's still being used to instantiate FreestyleSandboxes in the domain router.

The issue is that if the env variable is missing or undefined, it ends up trying to create the SDK with undefined as the API key. That probably causes the constructor to throw, which then crashes the dev server and since it's in the startup path, it just keeps restarting in an infinite loop.

We’ll either need to make the env var required or add a proper check before initializing the SDK.

Rish-it avatar Jun 07 '25 12:06 Rish-it

Any idea to this ? https://github.com/onlook-dev/onlook/issues/2098

subhojit-crypto avatar Jun 07 '25 12:06 subhojit-crypto

@subhojit-crypto are you setting up desktop app?

Rish-it avatar Jun 07 '25 12:06 Rish-it

Hello, Sorry this is a new env variable that needed to be handled better. Fixed now https://github.com/onlook-dev/onlook/pull/2097

Kitenite avatar Jun 07 '25 15:06 Kitenite