Skip to content

Commit

Permalink
fix(cubejs-cli): Fix content type and body after switching from reque…
Browse files Browse the repository at this point in the history
…st to node-fetch (#9088)
  • Loading branch information
KSDaemon authored Jan 9, 2025
1 parent e4c5d3f commit bf332ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/cubejs-backend-cloud/src/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class CubeCloudClient {
restOptions.headers = restOptions.headers || {};
// Add authorization to headers
(restOptions.headers as any).authorization = authorization.auth;
(restOptions.headers as any)['Content-type'] = 'application/json';

const response = await fetch(
`${authorization.url}/${url(authorization.deploymentId || '')}`,
Expand Down Expand Up @@ -141,6 +142,9 @@ export class CubeCloudClient {
url: (deploymentId: string) => `build/deploy/${deploymentId}/finish-upload${this.extendRequestByLivePreview()}`,
method: 'POST',
body: JSON.stringify({ transaction, files }),
headers: {
'Content-type': 'application/json'
},
auth,
});
}
Expand All @@ -149,7 +153,10 @@ export class CubeCloudClient {
return this.request({
url: (deploymentId) => `build/deploy/${deploymentId}/set-env`,
method: 'POST',
body: JSON.stringify({ envVariables }),
body: JSON.stringify({ envVariables: JSON.stringify(envVariables) }),
headers: {
'Content-type': 'application/json'
},
auth
});
}
Expand All @@ -172,6 +179,9 @@ export class CubeCloudClient {
url: (deploymentId) => `devmode/${deploymentId}/token`,
method: 'POST',
body: JSON.stringify(payload),
headers: {
'Content-type': 'application/json'
},
auth
});
}
Expand Down
6 changes: 5 additions & 1 deletion packages/cubejs-cli/src/command/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ const deploy = async ({ directory, auth, uploadEnv, token }: any) => {
url: (deploymentId) => `build/deploy/${deploymentId}/set-env`,
method: 'POST',
body: JSON.stringify({
envVariables,
envVariables: JSON.stringify(envVariables),
}),
headers: {
'Content-type': 'application/json'
},
auth
});
}
Expand Down Expand Up @@ -115,6 +118,7 @@ const deploy = async ({ directory, auth, uploadEnv, token }: any) => {
transaction,
files: fileHashesPosix
}),
headers: { 'Content-type': 'application/json' },
auth
});
} finally {
Expand Down

0 comments on commit bf332ef

Please sign in to comment.