MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / createTunnel

Method createTunnel

packages/cli/src/utils/triggerApi.ts:82–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80 }
81
82 async createTunnel() {
83 const response = await fetch(`${this.baseUrl}/api/v1/tunnels`, {
84 method: "POST",
85 headers: {
86 Accept: "application/json",
87 Authorization: `Bearer ${this.apiKey}`,
88 },
89 });
90
91 if (!response.ok) {
92 throw new Error(`Could not create tunnel: ${response.status}`);
93 }
94
95 const body = await response.json();
96
97 const parsedBody = CreateTunnelResponseSchema.safeParse(body);
98
99 if (!parsedBody.success) {
100 throw new Error(`Could not create tunnel: ${parsedBody.error.message}`);
101 }
102
103 return parsedBody.data;
104 }
105
106 async whoami(): Promise<WhoamiResponse | undefined> {
107 const response = await fetch(`${this.baseUrl}/api/v1/whoami`, {

Callers 1

createNativeTunnelFunction · 0.45

Calls 2

jsonMethod · 0.80
fetchFunction · 0.70

Tested by

no test coverage detected