the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update Daytona auth handling when API key missing

+33 -21
+33 -21
apps/api/src/xrpc/io/pocketenv/sandbox/putPreferences.ts
··· 126 126 ) => { 127 127 switch (pref.name) { 128 128 case "daytona": 129 - await tx 130 - .insert(daytonaAuth) 131 - .values({ 132 - userId: user.id, 133 - sandboxId: input.body.sandboxId, 134 - apiKey: pref.apiKey!, 135 - redactedApiKey: pref.redactedApiKey!, 136 - organizationId: pref.organizationId!, 137 - }) 138 - .onConflictDoUpdate({ 139 - target: [daytonaAuth.sandboxId, daytonaAuth.userId], 140 - set: { 141 - ...(pref.apiKey 142 - ? { apiKey: pref.apiKey, redactedApiKey: pref.redactedApiKey! } 143 - : {}), 144 - ...(pref.organizationId 145 - ? { organizationId: pref.organizationId } 146 - : {}), 147 - }, 148 - }) 149 - .execute(); 129 + if (pref.apiKey) { 130 + await tx 131 + .insert(daytonaAuth) 132 + .values({ 133 + userId: user.id, 134 + sandboxId: input.body.sandboxId, 135 + apiKey: pref.apiKey, 136 + redactedApiKey: pref.redactedApiKey!, 137 + organizationId: pref.organizationId!, 138 + }) 139 + .onConflictDoUpdate({ 140 + target: [daytonaAuth.sandboxId, daytonaAuth.userId], 141 + set: { 142 + apiKey: pref.apiKey, 143 + redactedApiKey: pref.redactedApiKey!, 144 + ...(pref.organizationId 145 + ? { organizationId: pref.organizationId } 146 + : {}), 147 + }, 148 + }) 149 + .execute(); 150 + } else if (pref.organizationId) { 151 + await tx 152 + .update(daytonaAuth) 153 + .set({ organizationId: pref.organizationId }) 154 + .where( 155 + and( 156 + eq(daytonaAuth.sandboxId, input.body.sandboxId), 157 + eq(daytonaAuth.userId, user.id), 158 + ), 159 + ) 160 + .execute(); 161 + } 150 162 break; 151 163 case "deno": 152 164 await tx