GCP Deploy using @fastify/mongodb
johntom opened this issue · comments
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
3.29.0
Plugin version
3.0.1
Node.js version
16.15.0
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
Version 21H1 build19043.1706
Description
I updated repo to lastest version of the following
"mongodb": "^4.6.0"
@fastify/mongodb": "^5.0.0
Locally the connection to scagrid mongo 4.4 works fine.
When I deploy to GCP I get the following error
AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Server selection timed out after 7500 ms
at wrap (/workspace/server.js:118:5)
at /workspace/node_modules/fastify/lib/server.js:147:31
at manageErr (/workspace/node_modules/fastify/fastify.js:505:11)
at /workspace/node_modules/fastify/fastify.js:494:11
at Object._encapsulateThreeParam (/workspace/node_modules/avvio/boot.js:551:7)
at Boot.timeoutCall (/workspace/node_modules/avvio/boot.js:447:5)
at Boot.callWithCbOrNextTick (/workspace/node_modules/avvio/boot.js:428:19)
at release (/workspace/node_modules/fastq/queue.js:149:16)
at Object.resume (/workspace/node_modules/fastq/queue.js:82:7)
at /workspace/node_modules/avvio/boot.js:167:18
at Timeout._onTimeout (/workspace/node_modules/mongodb/lib/sdam/topology.js:305:38)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
All deployements work as expected using scalegrid version mongodb 3.6
with the folliwing
mongodb@3.2.7
"fastify-mongodb": "^1.0.1",
"fastify": "^2.6.0",
"fastify-plugin": "^1.6.0"
Steps to Reproduce
Update repos to latest versions and use a scalegrid mongodb 4.4 connection
MONGODB_URLtodo=mongodb://admin:@SG-gtz-nano2-52001.servers.mongodirector.com:27017/todo?ssl=true&connectTimeoutMS=10000&authSource=admin
Expected Behavior
gcloud app deploy without errors which deplous when I eliminate databsae connection.
I will close it since it is barely a problem from @fastify/mongodb
.
As I said before, this package just helps you to initialize the connection using the official mongodb
package.
If there are any issue related to the connection. It will be either related to scalegrid
itself, GCP
or the upstream.
Ok, I will take a deeper dive but it's a different issue than prevously reported as it did not connect running server locally and I posted the solution.
Thanks for looking
Hi,
I resolved all issues, mostly scalegrid and atlas require ip addesses allowed . I tested against 0.0.0.0/0 and then found the gcp ips I can use. Previously when using scalegrid for 3.6 of mongo I never had to enter ips.
Also gcp was complaiinging about some callbacks that I converted to async/awat
I'mm going to post an article on medium and will send you link whan and if.
Thanks again.
John