deno-lambda
deno-lambda copied to clipboard
Deno 1.36.4 issues with aws cdk
Hey :wave:
Tried running Deno 1.36.4 by cloning the repo, bumping the deno version and uploading a new layer. I do however get the following issues trying to use aws cdk via the npm
specifier:
TypeError [ERR_INVALID_ARG_TYPE]" argument must be of type string. Received null
at assertPath (ext:deno_node/path/_util.ts:10:11)
at join (ext:deno_node/path/_posix.ts:77:5)
at getCredentialsFilepath (file:///tmp/deno_dir/npm/registry.npmjs.org/@smithy/shared-ini-file-loader/2.0.8/dist-cjs/getCredentialsFilepath.js:7:99)
at loadSharedConfigFiles (file:///tmp/deno_dir/npm/registry.npmjs.org/@smithy/shared-ini-file-loader/2.0.8/dist-cjs/loadSharedConfigFiles.js:11:76)
at file:///tmp/deno_dir/npm/registry.npmjs.org/@smithy/node-config-provider/2.0.9/dist-cjs/fromSharedConfigFiles.js:8:102
at file:///tmp/deno_dir/npm/registry.npmjs.org/@smithy/property-provider/2.0.7/dist-cjs/chain.js:12:39
at async coalesceProvider (file:///tmp/deno_dir/npm/registry.npmjs.org/@smithy/property-provider/2.0.7/dist-cjs/memoize.js:14:24)
at async file:///tmp/deno_dir/npm/registry.npmjs.org/@smithy/property-provider/2.0.7/dist-cjs/memoize.js:26:28 {
code: "ERR_INVALID_ARG_TYPE",
name: "TypeError",
toString: [Function (anonymous)]
}
The error is caused by this:
export { SSMClient, GetParameterCommand } from "npm:@aws-sdk/client-ssm"
export default async function () {
console.log("DENO VERSION", Deno.version.deno)
const client = new SSMClient()
const command = new GetParameterCommand({
Name: Deno.env.get("SSM_CONFIG"),
WithDecryption: true,
})
try {
console.log('Loading SSM', Deno.env.get("SSM_CONFIG"))
// FAILS HERE
const response = await client.send(command)
const config = JSON.parse(response.Parameter.Value)
for (const [key, value] of Object.entries(config)) {
console.log([key, value])
Deno.env.set(key, String(value))
}
} catch (e) {
console.log('Error:', e)
Deno.exit();
}
}
The code does work locally, however I can't get it working with the layer.
It does look like the runtime and/or bootstrap files probably need updating to support the latest Deno changes. Did anyone manage to get that working? Is this project still supported or has it been abandoned, as I can see no updates have been made since v 1.32?
I'm not having this issue but I'm worried about the v1.32 fixed in this compatibility layer (AWS Layer), I would love if they pump up to 1.37 but I think you'll need to make some changes on how data comes to Deno
Looks like the repo is no longer being kept up to date with the latest releases. Hopefully sth new will come up or someone will take over. Hat down to Andy for doing it for this long.
I was having the same issue, I found a workaround that is working fine for me, not sure if will work for you, but just in case.
I had to set up the below envs(any value is fine):
AWS_CONFIG_FILE=NONE
AWS_SHARED_CREDENTIALS_FILE=NONE
I found the issue is on node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js