Hi, I was just getting started with Datomic Ions but I got the following error at the Create Lambda step while deploying. So I'll just leave what I did to resolve it here. I'm not sure if this is the right way to fix it but its working for me so I think I'll proceed by modifying the CloudFormation Template.
{
"errorType": "ResourceConflictException",
"errorMessage": "Function already exist: REDACTED",
"trace": [
"ResourceConflictException: Function already exist: REDACTED",
" at de_ResourceConflictExceptionRes (/var/runtime/node_modules/@aws-sdk/client-lambda/dist-cjs/index.js:4474:21)",
" at de_CommandError (/var/runtime/node_modules/@aws-sdk/client-lambda/dist-cjs/index.js:3974:19)",
" at process.processTicksAndRejections (node:internal/process/task_queues:105:5)",
" at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/middleware-serde/dist-cjs/index.js:36:20",
" at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/core/dist-cjs/index.js:193:18",
" at async /var/runtime/node_modules/@aws-sdk/node_modules/@smithy/middleware-retry/dist-cjs/index.js:312:38",
" at async /var/runtime/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22"
]
}
I needed to update the CreateLambdaFromArray Lambda code like the following.
@@ -59,7 +59,7 @@
callback(null, event);
})
.catch((err) => {
- if(err.code === "ResourceConflictException"
+ if(err.name === "ResourceConflictException"
&& err.message.startsWith("Function already exist")) {
// mark this create as done, and copy it to update
event.lambda.cI--;
This was the Datomic Cloud primary compute file I was using.
https://s3.amazonaws.com/datomic-cloud-1/cft/1172/compute-template-9392-1172.jsonI've got dozens of lambdas and have never run into that problem -neither on the latest version of DC nor on earlier versions. Just to make sure we're on the same page: DC creates the necessary AWS Lambda function for you. That lambda routes requests to your ion clojure code (running on your EC2 instance). You never need to touch the AWS Lambda service directly.
Yeah I was expecting it to do that but it didn't work for me. All I did was create the CloudFormation stacks for storage and compute primary and then just tried to deploy the starter project only modifying the project name. Then I got this error.
Maybe because I dont have aws cli v1 installed?
aws --version
aws-cli/2.23.11 Python/3.12.6 Darwin/24.6.0 exe/x86_64I am not sure if that is your reason for failure, but we do have an upcoming release addressing the SDK
What is in your ion-config.edn file? That plus the name of your primary compute group determines the lambda fn name.
{:allow [datomic.ion.starter.attributes/valid-sku?]
:lambdas {:ensure-sample-dataset
{:fn datomic.ion.starter.lambdas/ensure-sample-dataset
:description "creates database and transacts sample data"
:concurrency-limit :none}
:get-schema
{:fn datomic.ion.starter.lambdas/get-schema
:description "returns the schema for the Datomic docs tutorial"
:concurrency-limit :none}
:get-items-by-type
{:fn datomic.ion.starter.lambdas/get-items-by-type
:description "return inventory items by type"
:concurrency-limit :none}}
:http-direct {:handler-fn datomic.ion.starter.http/get-items-by-type}
:app-name "my-app"}
I only changed the app-name. The other stuff is still from the starter template.I think the version change of the aws sdk on the lambda function is the cause. https://github.com/aws/aws-sdk-js-v3/blob/main/UPGRADING.md#error-handling
I'm not able to comment on the aws sdk for js because I never ever ever have to think about the code running on the lamdbas. I still think there is some kind of misunderstanding here. The version of the aws js sdk is the version selected by DC when building the lambda fn. And that "just works" when I configure my ion-config.edn with a name.
I'm sorry I'm not more help here.... what is the name of your primary compute group? Presumably that is where you want your lambda functions to forward requests.
> I never ever ever have to think about the code running on the lamdbas. Yes, I think that is the intended way, but I ran into the error and couldn't proceed so I had to look inside... After I changed that bit of code inside the lambda, my deploy was successful and I was able to invoke my clj functions through ions so I think my configuration is correct. The js sdk v2 support ended recently (september last year) so I still think that's the reason. https://aws.amazon.com/blogs//developer/announcing-end-of-support-for-aws-sdk-for-javascript-v2/
While the out-of-date dependencies are certainly not what I would like, I'm surprised that blocks you from creating a lambda. Perhaps @jaret can weigh in on whether or not this is a known failure mode.