When running the Local Testing Framework, this error has recently started to occur. The LTF was running fine previously.
Checking for updates... You are using the latest version.
Starting Mongo...
marking alarm_volume_balance-mongo to stop
MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27018
at Timeout._onTimeout (C:\Users\Misael.Uzcategui\AppData\Roaming\npm\node_modules\@corva\local-testing-framework\node_modules\mongodb\src\sdam\topology.ts:623:30)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
1 Like
@Nehemias Do you have an idea on how to fix this error?
1 Like
@Michael.Cortez the main reason this could happen is because in corvac.json file you have declare an url as your mongodb connection:
So if there is not a mongo db running in that ip and port it wont be able to connect and run the event.
Now if you have declare a container instead of an url in your corvac.json file check that the mongo db container is actually running and available at the specified port.
If it is and it is not working please stop the containers and run again corva local command.
1 Like
@mihael.cortez with the change:
“mongo”: {
“url”: “mongodb://localhost:27017”
},
And running my local MongoDB, the result was (no error bud no output):
"Checking for updates… You are using the latest version.
Starting Redis…
marking alarm_volume_balance-redis to stop
Starting API…
marking alarm_volume_balance-api-lite to stop
Generating Event Stream…
Running…
marking … to stop
Lambda API listening on port 9001…
Finished"
Also, with this configuration:
"mongo": {
"image": "mongo:latest",
"port": 27017
},
the output is:
Checking for updates… You are using the latest version.
Starting Mongo…
marking alarm_volume_balance-mongo to stop
MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
at Timeout._onTimeout (C:\Users\Misael.Uzcategui\AppData\Roaming\npm\node_modules@corva\local-testing-framework\node_modules\mongodb\src\sdam\topology.ts:623:30)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
1 Like
Solution:
under .corvarc.json:
"mongo": {
"image": "mongo:latest",
"port": 27017
},
Under Dokerfile:
FROM python:3.8.8-slim-buster
WORKDIR /tmp/build
COPY . .
RUN apt-get update -y
RUN pip3 install -r requirements.txt -t .
FROM lambci/lambda:python3.8
COPY --from=0 /tmp/build /var/task
Uninstall corva-sdk and install again (validate is the latest version).
Delete all the Docker Containers, Images, and Volumes.
Restart computer and open Visual Studio Code from folder that contains the lambda_function.py.
1 Like
Another solution to the above error is
1 . corva-sdk uninstall and install
2. clean the docker (i tried to reset it to factory defaults)
I haven’t changed my docker file or my MongoDB port the above two steps worked to resolve the issue.
1 Like