Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/sdk/devbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,15 @@ export class DevboxNetOps {
}

/**
* @deprecated Only works with legacy tunnels created via {@link createTunnel}.
* V2 tunnels (from {@link enableTunnel}) remain active until devbox shutdown and cannot be removed.
*
* Remove a legacy tunnel from the devbox.
* Remove an existing V2 tunnel from the devbox.
*
* @example
* ```typescript
* // Deprecated - only for legacy tunnels
* await devbox.net.removeTunnel();
* ```
*
* @param {Core.RequestOptions} [options] - Request options
* @returns {Promise<DevboxRemoveTunnelResponse>} Tunnel removal result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this still return an empty promise

* @returns {Promise<void>}
*/
async removeTunnel(options?: Core.RequestOptions) {
return this.client.devboxes.removeTunnel(this.devboxId, options);
Expand Down
2 changes: 1 addition & 1 deletion tests/objects/devbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ describe('Devbox (New API)', () => {
expect(result).toEqual(mockTunnel);
});

it('should remove legacy tunnel', async () => {
it('should remove tunnel', async () => {
mockClient.devboxes.removeTunnel.mockResolvedValue(undefined);

const result = await devbox.net.removeTunnel();
Expand Down
5 changes: 5 additions & 0 deletions tests/smoketests/object-oriented/devbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ describe('smoketest: object-oriented devbox', () => {
const info = await devbox.getInfo();
expect(info.tunnel).toBeDefined();
expect(info.tunnel?.tunnel_key).toBe(tunnel.tunnel_key);

await devbox.net.removeTunnel();

const tunnelAfterRemoval = await devbox.getTunnel();
expect(tunnelAfterRemoval).toBeNull();
} finally {
await devbox.shutdown();
}
Expand Down
Loading