Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Deployed Function does not handle mongodb+srv url #37

Open
noce2 opened this issue Oct 12, 2020 · 1 comment
Open

Azure Deployed Function does not handle mongodb+srv url #37

noce2 opened this issue Oct 12, 2020 · 1 comment
Labels
bug Something isn't working requires investigation

Comments

@noce2
Copy link
Contributor

noce2 commented Oct 12, 2020


name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''


Describe the bug
On startup of the deployed azure function, spring fails with an exception about a TXT record not being found for the mongoDb url. Locally, on a desktop, the function could use an srv url and startup appropriately

To Reproduce
Steps to reproduce the behavior:

  1. Checkout project on commit cc45ce0
  2. Follow the instructions to build the project, taking care to set the mongoDb url to a replica set style url with mongodb+srv as the protocol
  3. The app will be seen to start up correctly
  4. Modify the MongoDB URI of a deployed function
  5. Send a request to the function and it will respond with a 500 because Spring did not start-up successfully

Expected behavior
The function should startup successfully, making use of the appropriate dns lookup to resolve the mongo domain to the records for the 3 replica sets that sit beneath it

Screenshots
If applicable, add screenshots to help explain your problem.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.data.mongodb.core.MongoDbFactorySupport]: 
Factory method 'mongoDbFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'mongoClient' defined in class path resource [io/mathdojo/useraccountservice/configuration/DBConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mongodb.client.MongoClient]: 
Factory method 'mongoClient' threw exception; nested exception is com.mongodb.MongoConfigurationException: Unable to look up TXT record for host nonprodcluster.midgi.azure.mongodb.net

Environment Info (please complete the following information):
JVM:

openjdk version "1.8.0_242"
OpenJDK Runtime Environment (Zulu 8.44.0.9-CA-win64) (build 1.8.0_242-b20)
OpenJDK 64-Bit Server VM (Zulu 8.44.0.9-CA-win64) (build 25.242-b20, mixed mode)

Azure Functions Runtime (please complete the following information):**

  • 2.0

Additional context
Add any other context about the problem here.

@noce2 noce2 added bug Something isn't working requires investigation labels Oct 12, 2020
@rtlefrancois
Copy link

Got kind of the same issue, but using python. Did you figured it out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working requires investigation
Projects
None yet
Development

No branches or pull requests

2 participants