Skip to content

Conversation

@hentrymartin
Copy link
Collaborator

What's in this PR?

  • This PR creates the /profileDownload endpoint which would be used to stream the profile as PDF to the client
  • This also fixes some dependency errors related to tc-core-library-js
  • The endpoint works fine in my local(Please refer to the screenshot below)
  • Its not getting deployed in dev because of out of memory(OOM) memory.

Screenshot

Screenshot 2026-01-08 at 01 42 41

OOM error

Screenshot 2026-01-08 at 02 19 09


module.exports = {
generatePDF
} No newline at end of file
Copy link

Choose a reason for hiding this comment

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

[💡 style]
Ensure that a newline is added at the end of the file. This is a common convention that can prevent issues with certain tools and version control systems.

@hentrymartin hentrymartin requested a review from kkartunov January 8, 2026 01:35
const awsConfig = {
s3: config.AMAZON.S3_API_VERSION,
// S3 Client configuration
const s3ClientConfig = {
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The s3ClientConfig object is missing the s3 key which was present in the previous awsConfig. Ensure that the S3 API version is correctly configured if required by the new SDK.

}
// Upload to S3
await getS3().upload(params).promise()
const upload = new Upload({
Copy link

Choose a reason for hiding this comment

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

[⚠️ performance]
The Upload class from @aws-sdk/lib-storage is used here. Ensure that this library is compatible with the current AWS SDK version and that it handles large file uploads efficiently to avoid potential memory issues.

callback(null, { Body: Buffer.from(photoContent) })
})
originalS3ClientSend = S3Client.prototype.send
S3Client.prototype.send = async function (command) {
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
Overriding S3Client.prototype.send directly can lead to issues if other tests or parts of the code rely on the original behavior. Consider using a mocking library like sinon to stub this method instead, which can provide better control and restore functionality.

callback(null)
})
// Mock Upload class's done method for upload operations
originalUpload = Upload.prototype.done
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
Overriding Upload.prototype.done directly can lead to issues if other tests or parts of the code rely on the original behavior. Consider using a mocking library like sinon to stub this method instead, which can provide better control and restore functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants