No suitable servers found (`serverSelectionTryOnce` set) laravel error

Hi, I am using connection string from the mongodb atlas,

if i use connection string in local environment it is working fine, but in production server it is trowing an error.

No suitable servers found (serverSelectionTryOnce set): [TLS handshake failed: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error calling hello on ‘cluster0-shard-00-00.0edlk.mongodb.net:27017’] [TLS handshake failed: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error calling hello on ‘cluster0-shard-00-01.0edlk.mongodb.net:27017’] [TLS handshake failed: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error calling hell

laravel version: 11
php version: 8.2.20
production: vercel

connection string:
DB_URI=“mongodb+srv://username:password@cluster0.0edlk.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0”

mongodb configuration

‘mongodb’ => [
‘driver’ => ‘mongodb’,
‘dsn’ => env(‘DB_URI’),
‘host’ => [
cluster0-shard-00-02.0edlk.mongodb.net:27017’,
cluster0-shard-00-00.0edlk.mongodb.net:27017’,
cluster0-shard-00-01.0edlk.mongodb.net:27017’,
],
‘options’ => [
‘ssl’ => ‘true’,
‘replicaSet’ => ‘atlas-gyqjiz-shard-0’,
‘authSource’ => ‘admin’,
‘retryWrites’ => ‘true’,
‘w’ => ‘majority’
],
‘port’ => env(‘DB_PORT’, 27017),
‘database’ => env(‘DB_DATABASE’),
‘username’ => env(‘DB_USERNAME’),
‘password’ => env(‘DB_PASSWORD’),

    ],

Update: issue solved, i just needed to add mongodb plugin to my project on vercel

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.