Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Lucid in an AWS Lambda function? #207

Open
owenbirdsall opened this issue Jul 26, 2023 · 2 comments
Open

Using Lucid in an AWS Lambda function? #207

owenbirdsall opened this issue Jul 26, 2023 · 2 comments

Comments

@owenbirdsall
Copy link

owenbirdsall commented Jul 26, 2023

I've spent the past few days trying to get Lucid running in my lambda function.

Switching to ESM format and updating to aws-sdk-v3 & nodejs v18 has got me what feels like very close.

However I am now stuck with a Cannot read properties of null (reading 'TransactionBuilderConfigBuilder') error when calling Lucid.new(...

It sounds very similar to #137 ...so I added support for wasm in my CDK NodejsFunction constructor by setting NODE_OPTIONS to "--experimental-wasm-modules" which should add support for loading wasm modules in a lambda environment as described here: https://merckx.dev/notes/loading-wasm.html

However I still get the same error. I then tried multiple versions of Lucid - as recommended by various people who had TransactionBuilderConfigBuilder issues. So far I've tried 0.7.0, 0.7.2, 0.9.8 & 0.10.6, all of which give the same error.

Any help would be greatly appreciated, or if there's an alternative anyone could recommend? My usecase is that I simply want to select a wallet by private key and mint an nft from within a lambda function.

@Muhammad-Nabeel-Asif
Copy link

The error message indicates that the property 'TransactionBuilderConfigBuilder' is being accessed on a null object, which means that the object is not properly initialized or defined.

Here are some steps you can follow to debug and fix the issue:

Check if Lucid is properly installed: Ensure that you have installed the Lucid library correctly in your Lambda function. You can check the installation by looking for the 'node_modules' folder in your Lambda deployment package.

Verify the import statement: Double-check the import statement for Lucid in your Lambda function. Make sure you are importing it correctly and using the correct path.

Check for null objects: Review the code that initializes the 'TransactionBuilderConfigBuilder' object. Make sure that it is properly initialized and not set to null at any point before you try to access its properties.

Handle potential null values: If there are cases where 'TransactionBuilderConfigBuilder' might be null, use conditional checks (such as if statements or optional chaining) to handle these scenarios and prevent accessing properties on null objects.

Review the Lucid documentation: Check the official documentation for Lucid to ensure that you are using the library correctly and that you are following the recommended setup and usage instructions.

Enable logging and error handling: Implement logging and error handling in your Lambda function to capture any potential issues during runtime. This will help you identify the specific cause of the error and assist in troubleshooting.

Test in a local environment: Try running your Lambda function in a local development environment (such as on your local machine) with a sample input to see if you can reproduce the error and debug it more effectively.

@owenbirdsall
Copy link
Author

Appreciate the help, but I've already tried asking ChatGPT ;)

@owenbirdsall owenbirdsall changed the title Has anyone managed to get Lucid running in an AWS Lambda function? Using Lucid in an AWS Lambda function? Jul 28, 2023
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

No branches or pull requests

2 participants