Skip to main content
All CollectionsRealm
Troubleshooting App Services 'service not found', 'cannot access member db', and 'undefined log' errors
Troubleshooting App Services 'service not found', 'cannot access member db', and 'undefined log' errors

cannot access member 'db' of undefined, service not found

Rachelle Palmer avatar
Written by Rachelle Palmer
Updated over a year ago

Errors such as:

cannot access member db of undefined,

service not found, and

undefined log error

are often caused by an incorrect App ID or an incorrect Service Name being specified in your application code. To resolve the issue, reference the correct App ID and Service Name.

App ID

The App ID is usually in the format of the concatenation of your app name and a 5 letter suffix (for example, test-abcde). The App ID can be found under Settings > Application ID. You can also copy it from the left navigation menu of the App Services UI:

Note this is not the same as the Service Name. The App ID must be specified if you want to connect to your application using the application code, but it does not need to be specified in the code inside your App.

Service Name

The Service Name is a reference to the linked data sources, such as an Atlas cluster, that your application can access. You can find all Service Names under Linked Data Sources in the left navigation menu of your App.

  • When linking a new Atlas cluster to your App, enter a new Service Name. Note that you cannot use a Service Name that already exists in that App. You must use this service name when you want to connect to the Atlas cluster using the application code or code inside your App.
    โ€‹

Examples

  • When initializing a MongoDB service client in the App Services UI, you do not need to specify the App ID since you are already creating this function inside your application:

    const mongoClient = context.services.get("<ServiceName>") const collection = mongoClient.db("<dbname>").collection("<collname>");

  • For connecting to the App from your application, see our documentation on different SDKs.

Did this answer your question?