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.
I have started my professional journey in Chennai, India after completing my masters in software engineering. My first assignment was into mobile testing using calabash and I liked it. Sooner, I was asked to train the whole Bangalore team of around 25+ testers.
I have learned and worked a little in domains like big data, machine learning, e-commerce, and telecom over a period of almost a decade. I have previously worked with Photon, Hewlett Packard, Polaris Networks and Cognizant. I am a certified scrum master. Once, I started leading the teams, I realized that I wanted to understand and learn how the complete business cycle in an organization works and how/what should be done to leverage a firms competitive advantage. Therefore, I planned to pursue masters in business administration. Organizational Behavior and Strategy are my favorites.
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. I have run 5 marathons till now. I have presented few papers at national conferences.