Skip to content

Commit 13dcfde

Browse files
committed
fix(amazonqFeatureDev): generate uploadId in fe
1 parent 80d2f0b commit 13dcfde

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@
669669
"contentLength": { "shape": "CreateUploadUrlRequestContentLengthLong" },
670670
"artifactType": { "shape": "ArtifactType" },
671671
"uploadIntent": { "shape": "UploadIntent" },
672-
"uploadContext": { "shape": "UploadContext" }
672+
"uploadContext": { "shape": "UploadContext" },
673+
"uploadId": { "shape": "UploadId" }
673674
}
674675
},
675676
"CreateUploadUrlRequestContentChecksumString": {

packages/core/src/amazonqFeatureDev/client/featureDev.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ export class FeatureDevClient {
8080
}
8181
}
8282

83-
public async createUploadUrl(conversationId: string, contentChecksumSha256: string, contentLength: number) {
83+
public async createUploadUrl(
84+
conversationId: string,
85+
contentChecksumSha256: string,
86+
contentLength: number,
87+
uploadId: string
88+
) {
8489
try {
8590
const client = await this.getClient()
8691
const params = {
@@ -89,6 +94,7 @@ export class FeatureDevClient {
8994
conversationId,
9095
},
9196
},
97+
uploadId,
9298
contentChecksum: contentChecksumSha256,
9399
contentChecksumType: 'SHA_256',
94100
artifactType: 'SourceCode',
@@ -98,7 +104,7 @@ export class FeatureDevClient {
98104
getLogger().debug(`Executing createUploadUrl with %O`, omit(params, 'contentChecksum'))
99105
const response = await client.createUploadUrl(params).promise()
100106
getLogger().debug(`${featureName}: Created upload url: %O`, {
101-
uploadId: response.uploadId,
107+
uploadId: uploadId,
102108
requestId: response.$response.requestId,
103109
})
104110
return response

packages/core/src/amazonqFeatureDev/session/sessionState.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,12 @@ export class PrepareCodeGenState implements SessionState {
469469
action.telemetry,
470470
span
471471
)
472-
473-
const { uploadUrl, uploadId, kmsKeyArn } = await this.config.proxyClient.createUploadUrl(
472+
const uploadId = randomUUID()
473+
const { uploadUrl, kmsKeyArn } = await this.config.proxyClient.createUploadUrl(
474474
this.config.conversationId,
475475
zipFileChecksum,
476-
zipFileBuffer.length
476+
zipFileBuffer.length,
477+
uploadId
477478
)
478479

479480
await uploadCode(uploadUrl, zipFileBuffer, zipFileChecksum, kmsKeyArn)

0 commit comments

Comments
 (0)