Skip to content

Commit c9f85a7

Browse files
authored
Merge pull request #8859 from opengovsg/release_v6.265.0
build: release v6.265.0
2 parents 2ae0333 + b72e2ff commit c9f85a7

File tree

9 files changed

+63
-145
lines changed

9 files changed

+63
-145
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,25 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [v6.265.0](https://github.com/opengovsg/FormSG/compare/v6.264.0...v6.265.0)
8+
9+
- fix(deps): bump playwright and @playwright/test [`#8827`](https://github.com/opengovsg/FormSG/pull/8827)
10+
- build(deps): bump tar-fs from 3.1.0 to 3.1.1 in /serverless/pdf-gen-sparticuz [`#8758`](https://github.com/opengovsg/FormSG/pull/8758)
11+
- fix(deps): bump validator from 13.15.15 to 13.15.20 in /shared [`#8840`](https://github.com/opengovsg/FormSG/pull/8840)
12+
- fix(deps): bump validator from 13.12.0 to 13.15.20 [`#8844`](https://github.com/opengovsg/FormSG/pull/8844)
13+
- build(deps): bump validator from 13.7.0 to 13.15.20 in /frontend [`#8845`](https://github.com/opengovsg/FormSG/pull/8845)
14+
- feat: pinning pdf to generate from lambda [`#8858`](https://github.com/opengovsg/FormSG/pull/8858)
15+
- build: merge release v6.264.0 to develop [`#8855`](https://github.com/opengovsg/FormSG/pull/8855)
16+
- build: release v6.264.0 [`#8853`](https://github.com/opengovsg/FormSG/pull/8853)
17+
718
#### [v6.264.0](https://github.com/opengovsg/FormSG/compare/v6.263.0...v6.264.0)
819

20+
> 3 November 2025
21+
922
- feat(i18n): extract text from various modals [`#8843`](https://github.com/opengovsg/FormSG/pull/8843)
1023
- build: merge release v6.263. to develop [`#8848`](https://github.com/opengovsg/FormSG/pull/8848)
1124
- build: release v6.263.0 [`#8847`](https://github.com/opengovsg/FormSG/pull/8847)
25+
- chore: bump version to v6.264.0 [`6dbbae0`](https://github.com/opengovsg/FormSG/commit/6dbbae04ad0d0d574bd9188ab11d26ebc3369d67)
1226

1327
#### [v6.263.0](https://github.com/opengovsg/FormSG/compare/v6.262.0...v6.263.0)
1428

frontend/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "form-frontend",
3-
"version": "6.264.0",
3+
"version": "6.265.0",
44
"homepage": ".",
55
"type": "module",
66
"private": true,
@@ -91,7 +91,7 @@
9191
"type-fest": "^4.17.0",
9292
"typescript": "^5.4.5",
9393
"use-draggable-scroll": "^0.1.0",
94-
"validator": "^13.7.0",
94+
"validator": "^13.15.20",
9595
"vite-plugin-node-stdlib-browser": "^0.2.1",
9696
"zustand": "^4.1.1"
9797
},

package-lock.json

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "FormSG",
33
"description": "Form Manager for Government",
4-
"version": "6.264.0",
4+
"version": "6.265.0",
55
"homepage": "https://form.gov.sg",
66
"authors": [
77
"FormSG <[email protected]>"
@@ -154,14 +154,14 @@
154154
"ulid": "^2.3.0",
155155
"uuid": "^11.1.0",
156156
"uuid-by-string": "^4.0.0",
157-
"validator": "^13.12.0",
157+
"validator": "^13.15.20",
158158
"winston": "^3.13.0",
159159
"winston-cloudwatch": "^6.3.0",
160160
"zod": "^3.24.3"
161161
},
162162
"devDependencies": {
163163
"@opengovsg/mockpass": "^4.3.4",
164-
"@playwright/test": "^1.53.0",
164+
"@playwright/test": "^1.56.1",
165165
"@types/bcrypt": "^5.0.0",
166166
"@types/bluebird": "^3.5.42",
167167
"@types/body-parser": "^1.19.6",

serverless/pdf-gen-sparticuz/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shared/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/utils/__tests__/convert-html-to-pdf.spec.ts

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -155,29 +155,6 @@ describe('convert-html-to-pdf', () => {
155155
beforeEach(() => {
156156
AwsConfig.pdfGeneratorLambda.invoke = jest.fn()
157157
})
158-
it('should not invoke lambda and just return local output when AwsConfig.pdfGeneratorLambdaFunctionName is empty', async () => {
159-
// Arrange
160-
const mockLocalBuffer = Buffer.from('local pdf content')
161-
AwsConfig.pdfGeneratorLambdaFunctionName = ''
162-
163-
// Mock local response
164-
const mockPage = {
165-
setContent: jest.fn(),
166-
pdf: jest.fn().mockResolvedValue(mockLocalBuffer),
167-
}
168-
const mockBrowser = {
169-
newPage: jest.fn().mockResolvedValue(mockPage),
170-
close: jest.fn(),
171-
}
172-
;(puppeteer.launch as jest.Mock).mockResolvedValue(mockBrowser)
173-
174-
// Act
175-
const result = await generatePdfFromHtml(MOCK_HTML, true)
176-
177-
// Assert
178-
expect(result).toEqual(mockLocalBuffer)
179-
expect(AwsConfig.pdfGeneratorLambda.invoke).not.toHaveBeenCalled()
180-
})
181158

182159
it('should use lambda output when isUseLambdaOutput is true and not use local output and AwsConfig.pdfGeneratorLambdaFunctionName is defined', async () => {
183160
// Arrange
@@ -225,46 +202,6 @@ describe('convert-html-to-pdf', () => {
225202
})
226203
})
227204

228-
it('should use local output when isUseLambdaOutput is false and not use lambda output and AwsConfig.pdfGeneratorLambdaFunctionName is defined', async () => {
229-
// Arrange
230-
const mockLambdaBuffer = Buffer.from('lambda pdf content')
231-
const mockLocalBuffer = Buffer.from('local pdf content')
232-
233-
const DUMMY_PDF_GENERATOR_FUNCTION_NAME =
234-
'dummy-pdf-generator-function-name'
235-
AwsConfig.pdfGeneratorLambdaFunctionName =
236-
DUMMY_PDF_GENERATOR_FUNCTION_NAME
237-
238-
// Mock lambda response
239-
const mockLambdaResponse = {
240-
Payload: JSON.stringify({
241-
statusCode: 200,
242-
body: mockLambdaBuffer.toString('base64'),
243-
}),
244-
}
245-
;(AwsConfig.pdfGeneratorLambda.invoke as jest.Mock).mockResolvedValueOnce(
246-
mockLambdaResponse,
247-
)
248-
249-
// Mock local response
250-
const mockPage = {
251-
setContent: jest.fn(),
252-
pdf: jest.fn().mockResolvedValue(mockLocalBuffer),
253-
}
254-
const mockBrowser = {
255-
newPage: jest.fn().mockResolvedValue(mockPage),
256-
close: jest.fn(),
257-
}
258-
;(puppeteer.launch as jest.Mock).mockResolvedValue(mockBrowser)
259-
260-
// Act
261-
const result = await generatePdfFromHtml(MOCK_HTML, false)
262-
263-
// Assert
264-
expect(result).toEqual(mockLocalBuffer)
265-
expect(result).not.toEqual(mockLambdaBuffer)
266-
})
267-
268205
it('should generate PDFs using both methods in parallel regardless of isUseLambdaOutput setting if AwsConfig.pdfGeneratorLambdaFunctionName is defined', async () => {
269206
// Arrange
270207
const mockLambdaBuffer = Buffer.from('lambda pdf content')
@@ -307,8 +244,8 @@ describe('convert-html-to-pdf', () => {
307244
// Assert
308245
// Both lambda and local generation should be called for each invocation
309246
expect(AwsConfig.pdfGeneratorLambda.invoke).toHaveBeenCalledTimes(2)
310-
expect(puppeteer.launch).toHaveBeenCalledTimes(2)
311-
expect(mockPage.pdf).toHaveBeenCalledTimes(2)
247+
expect(puppeteer.launch).toHaveBeenCalledTimes(0)
248+
expect(mockPage.pdf).toHaveBeenCalledTimes(0)
312249

313250
// Verify the lambda invocation parameters
314251
expect(AwsConfig.pdfGeneratorLambda.invoke).toHaveBeenCalledWith({

src/app/utils/convert-html-to-pdf.ts

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -146,31 +146,6 @@ export const generatePdfFromHtml = async (
146146
meta: logMeta,
147147
})
148148

149-
const localStopwatch = startStopwatch()
150-
const localResult = generatePdfFromHtmlLocally(summaryHtml).then((result) => {
151-
const latencyMs = localStopwatch.stop()
152-
logger.info({
153-
message: 'Successfully generated pdf from html using local',
154-
meta: { ...logMeta, latencyMs },
155-
})
156-
submitPdfGenerationLatencyMetric({
157-
latencyMs,
158-
isLocal: true,
159-
})
160-
return result
161-
})
162-
163-
const isPdfGenerationLambdaConfigured =
164-
!!AwsConfig.pdfGeneratorLambdaFunctionName
165-
if (!isPdfGenerationLambdaConfigured) {
166-
logger.info({
167-
message:
168-
'Pdf generation lambda is not configured - using result from local pdf generation',
169-
meta: logMeta,
170-
})
171-
return localResult
172-
}
173-
174149
const lambdaStopwatch = startStopwatch()
175150
const lambdaResultAsync = generatePdfFromHtmlLambda(summaryHtml).map(
176151
(result) => {
@@ -187,31 +162,22 @@ export const generatePdfFromHtml = async (
187162
},
188163
)
189164

190-
if (isUseLambdaOutput) {
191-
const lambdaResult = await lambdaResultAsync
192-
if (lambdaResult.isErr()) {
193-
logger.error({
194-
message: 'Error generating pdf from html using lambda',
195-
meta: logMeta,
196-
error: lambdaResult.error,
197-
})
198-
throw lambdaResult.error
199-
}
200-
201-
logger.info({
202-
message:
203-
'Successfully generated pdf from html - using result from lambda pdf generation',
165+
const lambdaResult = await lambdaResultAsync
166+
if (lambdaResult.isErr()) {
167+
logger.error({
168+
message: 'Error generating pdf from html using lambda',
204169
meta: logMeta,
170+
error: lambdaResult.error,
205171
})
206-
return lambdaResult.value
172+
throw lambdaResult.error
207173
}
208174

209175
logger.info({
210176
message:
211-
'Successfully generated pdf from html - using result from local pdf generation',
177+
'Successfully generated pdf from html - using result from lambda pdf generation',
212178
meta: logMeta,
213179
})
214-
return await localResult
180+
return lambdaResult.value
215181
}
216182

217183
export const _generatePdfFromHtmlLocallyForTest = generatePdfFromHtmlLocally

0 commit comments

Comments
 (0)