MongoDB Atlas へ移行した後、Heroku にデプロイした mLab Data API が動いていなかった

heroku logs –tail –app アプリ名 でログを確認すると、SSLHandshakeException が出ている??

2020-12-17T09:38:32.199913+00:00 app[web.1]: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate$1@7ed44d7e. Client view of cluster state is {type=REPLICA_SET, servers=[{address=***.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {javax.net.ssl.SSLHandshakeException: extension (5) should not be presented in certificate_request}}, 

MLAB_DATA_API_CONFIG を変更するだけで OK と思っていたが、JAVA_OPTS 環境変数を追加して -Djdk.tls.client.protocols=TLSv1.2 を設定する必要があった。

https://docs.mlab.com/how-to-self-host-the-mlab-data-api/#set-heroku-app-with-config-vars

無事解消してハッピー。

コメントを残す