Cannot connect database through clever cloud

Hi, i have deployed my node.js application and I have passed the name of the database which is generated from clever cloud as an environmental variable, yet when I am looking at the logs its telling me that

Error: No database selected

even though the database was already created during the deployment:

Nov 23 12:09:49 AM
Nov 23 12:09:49 AM Sequelize CLI [Node: 14.17.0, CLI: 6.6.2, ORM: 6.35.1]
Nov 23 12:09:49 AM
Nov 23 12:09:49 AM Loaded configuration file “config/config.js”.
Nov 23 12:09:49 AM Using environment “development”.
Nov 23 12:09:51 AM Database b38uxah5pnim79l8wcj5 created.
Nov 23 12:09:52 AM
Nov 23 12:09:52 AM Sequelize CLI [Node: 14.17.0, CLI: 6.6.2, ORM: 6.35.1]
Nov 23 12:09:52 AM
Nov 23 12:09:52 AM Loaded configuration file “config/config.js”.
Nov 23 12:09:52 AM Using environment “development”.
Nov 23 12:09:55 AM No migrations were executed, database schema was already up to date.

Why is this happening?

Note: I have created an env file and added the secret keys but still when i run it in local server, its working fine but it isnt working in here.

Hi there,

As this is not an error or problem with Render’s platform, we will be limited in our ability to assist here.

That being said, I recommend verifying all of your configuration files are valid and properly formatted. If you can’t trace the problem down to a configuration issue, the next step would be some good online research on the error you’re seeing in the logs to see if anyone else has worked through the same problem.

Regards,
Mike


Render Support Engineer, MT (UTC-7)

I have verified twice -thrice by creating one and two databases with cleaver-cloud and running it on my localhost, its still working fine and its freshly committed to the repository. I cannot figure out why I am facing this problem in Render even if its telling me that the database is created but while passing endpoints, its telling me database is not connected.

Hi there,

Running code on a local machine will not always automatically run the same when deployed in a server environment. There are many different variables that can lead to differences, such as different language versions, dependency versions, configuration, and even sometimes a “production mode” vs a “dev mode.”

As a next step here, I recommend debugging the application and/or adding more logging detail to isolate which line of code is throwing the error. Then you can verify that the connection information is exactly what you expect it to be and that the environment variables are getting pulled into the application as intended. If the line of code that tries to connect to the database is being fed all the right information and the error is still occurring, then it would be good to do some online research to see if anyone else has run into the same error under those circumstances.

Here’s a Stack Overflow thread I found that might provide some guidance as well.

Hope that helps!

Regards,
Mike


Render Support Engineer, MT (UTC-7)

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