Skip to content

Commit fe5d662

Browse files
committed
fix: include dependencies for the OpenSSL lambda
1 parent 809e037 commit fe5d662

File tree

4 files changed

+40
-20
lines changed

4 files changed

+40
-20
lines changed

cdk/resources/containers/buildOpenSSLLambdaImage.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
type ImageChecker,
55
} from '@bifravst/aws-cdk-ecr-helpers/image'
66
import { hashFolder } from '@bifravst/aws-cdk-ecr-helpers/hashFolder'
7+
import { hashFile } from '@bifravst/aws-cdk-ecr-helpers/hashFile'
78
import fs from 'node:fs/promises'
89
import run from '@bifravst/run'
910
import os from 'node:os'
@@ -12,7 +13,10 @@ import { checkSumOfStrings } from '@bifravst/aws-cdk-lambda-helpers/util'
1213
import type { logFn } from '../../../cli/log.js'
1314
import { ContainerRepositoryId } from '../../../aws/ecr.js'
1415
import { fileURLToPath } from 'node:url'
15-
const __dirname = fileURLToPath(new URL('.', import.meta.url))
16+
const __filename = fileURLToPath(import.meta.url)
17+
const __dirname = path.dirname(__filename)
18+
19+
import pJSON from '../../../package.json'
1620

1721
export const buildOpenSSLLambdaImage = async (
1822
builder: ImageBuilder,
@@ -27,7 +31,12 @@ export const buildOpenSSLLambdaImage = async (
2731
'lambda/openSSL.ts',
2832
)
2933

30-
const tag = checkSumOfStrings([await hashFolder(dockerFilePath), hash])
34+
const tag = checkSumOfStrings([
35+
await hashFolder(dockerFilePath),
36+
hash,
37+
await hashFile(path.join(__dirname, '..', '..', '..', 'package.json')),
38+
await hashFile(__filename),
39+
])
3140

3241
if (
3342
await checker({
@@ -47,6 +56,17 @@ export const buildOpenSSLLambdaImage = async (
4756
log: { debug, stderr: debug, stdout: debug },
4857
})
4958

59+
await run({
60+
command: 'npm',
61+
args: [
62+
'i',
63+
`@hello.nrfcloud.com/certificate-helpers@${pJSON.dependencies['@hello.nrfcloud.com/certificate-helpers']}`,
64+
`@bifravst/run@${pJSON.devDependencies['@bifravst/run']}`,
65+
],
66+
log: { debug, stderr: debug, stdout: debug },
67+
cwd: path.join(distDir, 'lambda'),
68+
})
69+
5070
await builder({
5171
id: ContainerRepositoryId.OpenSSLLambda,
5272
tag,

lambda/createCredentials.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ const h = async (
108108
).Payload?.transformToString() ?? '',
109109
)
110110

111-
const registrationArgs = {
111+
const deviceDetails = {
112112
deviceId,
113113
subType: 'map-custom',
114114
tags: ['map-custom'],
115115
certPem: certificate,
116116
}
117-
console.debug(`Registering`, JSON.stringify(registrationArgs))
117+
console.debug(`Registering`, JSON.stringify(deviceDetails))
118118

119-
const registration = await client.register([registrationArgs])
119+
const registration = await client.register([deviceDetails])
120120

121121
if ('error' in registration) {
122122
console.error(

package-lock.json

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

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232
"@aws-sdk/client-ecr": "3.621.0",
3333
"@aws-sdk/client-iot-data-plane": "3.621.0",
3434
"@aws-sdk/client-route-53": "3.621.0",
35-
"@bifravst/aws-cdk-ecr-helpers": "1.2.29",
35+
"@bifravst/aws-cdk-ecr-helpers": "1.3.0",
3636
"@bifravst/aws-cdk-lambda-helpers": "1.9.12",
3737
"@bifravst/aws-ssm-settings-helpers": "1.2.4",
3838
"@bifravst/bdd-markdown": "8.2.6",
3939
"@bifravst/ci": "2.0.2",
4040
"@bifravst/cloudformation-helpers": "9.1.1",
4141
"@bifravst/eslint-config-typescript": "6.1.13",
42-
"@bifravst/http-api-mock": "2.0.62",
42+
"@bifravst/http-api-mock": "2.0.63",
4343
"@bifravst/prettier-config": "1.0.4",
44-
"@bifravst/run": "1.2.0",
44+
"@bifravst/run": "^1.2.0",
4545
"@commitlint/config-conventional": "19.2.2",
4646
"@hello.nrfcloud.com/bdd-markdown-steps": "2.6.19",
4747
"@swc/cli": "0.4.0",
@@ -107,7 +107,7 @@
107107
"@bifravst/from-env": "3.0.2",
108108
"@bifravst/random-words": "8.0.2",
109109
"@bifravst/timestream-helpers": "6.0.3",
110-
"@hello.nrfcloud.com/certificate-helpers": "1.0.0",
110+
"@hello.nrfcloud.com/certificate-helpers": "^1.0.0",
111111
"@hello.nrfcloud.com/lambda-helpers": "1.3.17",
112112
"@hello.nrfcloud.com/nrfcloud-api-helpers": "5.3.21",
113113
"@hello.nrfcloud.com/proto": "14.2.5",

0 commit comments

Comments
 (0)