While working on a rust-based hackathon project at Qxf2, I encountered an unresponsive function when creating new project in Rust.
Being a newbie in rust, I was unable to figure out the cause. I tried looking up the internet but could not find any suitable solutions. Hence, I thought of documenting the resolution to this issue so that anyone hitting with same issue wouldn’t have to waste hours finding the cause.
Problem
To begin with, I had to build a Rust function for AWS lambda. To do this, I first tried creating a project which would give me the default template with the following command.
cargo lambda new rust_lambda
When you execute the command, you are shown the following in the terminal.
? Is this function an HTTP function? (y/N) [type `yes` if the Lambda function is triggered by an API Gateway, Amazon Load Balancer(ALB), or a Lambda URL] |
In my case, the lambda function was not triggered with any of the above, so I chose ‘No’ and hit enter and got none in the response i.e. the cursor just stayed at the same place without giving me a success or any error message.
The difficulty was not getting any error message and so, I was not sure why the command was not getting executed.
Root cause
I had to do trial and error before finding the root cause of the issue. It was the rust version. Sound simple, right? 🙂 but this took a while. I was using rust 1.61.0 and updating it to the latest version helped resolve the issue. I would be happier if it were shown on the terminal but that gave me a way to dig deeper.
Solution
The next step was to update the rustup which was the installer in my case with the following command:
rustup update stable
Before Update
$ rustc –version
rustc 1.61.0 (fe5b13d68 2022-05-18)
$ cargo –version
cargo 1.61.0 (a028ae42f 2022-04-29)
After update
$ rustc –version
rustc 1.64.0 (a55dd71d5 2022-09-19)
$ cargo –version
cargo 1.64.0 (387270bc7 2022-09-16)
Once, the rust is updated to the newer version, you can again run the cargo lambda new command.
Conclusion
I have come across a few scenarios in Rust where the issues arise due to version incompatibility. Hence, It is better to have the updated version while working with rust projects.
My journey in software testing began with Calabash and Cucumber, where I delved into Mobile Automation using Ruby. As my career progressed, I gained experience working with a diverse range of technical tools. These include e-Discovery, Selenium, Python, Docker, 4G/5G testing, M-CORD, CI/CD implementation, Page Object Model framework, API testing, Testim, WATIR, MockLab, Postman, and Great Expectation. Recently, I’ve also ventured into learning Rust, expanding my skillset further. Additionally, I am a certified Scrum Master, bringing valuable agile expertise to projects.
On the personal front, I am a very curious person on any topic. According to Myers-Briggs Type Indicator, I am described as INFP-T. I like playing soccer, running and reading books.