Skip to content

Commit bf332ef

Browse files
authored
fix(cubejs-cli): Fix content type and body after switching from request to node-fetch (#9088)
1 parent e4c5d3f commit bf332ef

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

packages/cubejs-backend-cloud/src/cloud.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class CubeCloudClient {
4141
restOptions.headers = restOptions.headers || {};
4242
// Add authorization to headers
4343
(restOptions.headers as any).authorization = authorization.auth;
44+
(restOptions.headers as any)['Content-type'] = 'application/json';
4445

4546
const response = await fetch(
4647
`${authorization.url}/${url(authorization.deploymentId || '')}`,
@@ -141,6 +142,9 @@ export class CubeCloudClient {
141142
url: (deploymentId: string) => `build/deploy/${deploymentId}/finish-upload${this.extendRequestByLivePreview()}`,
142143
method: 'POST',
143144
body: JSON.stringify({ transaction, files }),
145+
headers: {
146+
'Content-type': 'application/json'
147+
},
144148
auth,
145149
});
146150
}
@@ -149,7 +153,10 @@ export class CubeCloudClient {
149153
return this.request({
150154
url: (deploymentId) => `build/deploy/${deploymentId}/set-env`,
151155
method: 'POST',
152-
body: JSON.stringify({ envVariables }),
156+
body: JSON.stringify({ envVariables: JSON.stringify(envVariables) }),
157+
headers: {
158+
'Content-type': 'application/json'
159+
},
153160
auth
154161
});
155162
}
@@ -172,6 +179,9 @@ export class CubeCloudClient {
172179
url: (deploymentId) => `devmode/${deploymentId}/token`,
173180
method: 'POST',
174181
body: JSON.stringify(payload),
182+
headers: {
183+
'Content-type': 'application/json'
184+
},
175185
auth
176186
});
177187
}

packages/cubejs-cli/src/command/deploy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ const deploy = async ({ directory, auth, uploadEnv, token }: any) => {
6666
url: (deploymentId) => `build/deploy/${deploymentId}/set-env`,
6767
method: 'POST',
6868
body: JSON.stringify({
69-
envVariables,
69+
envVariables: JSON.stringify(envVariables),
7070
}),
71+
headers: {
72+
'Content-type': 'application/json'
73+
},
7174
auth
7275
});
7376
}
@@ -115,6 +118,7 @@ const deploy = async ({ directory, auth, uploadEnv, token }: any) => {
115118
transaction,
116119
files: fileHashesPosix
117120
}),
121+
headers: { 'Content-type': 'application/json' },
118122
auth
119123
});
120124
} finally {

0 commit comments

Comments
 (0)