Atlas custom function logging not working

New to functions. Confused about the conditions under which logging works–especially for functions.

  • The documentation says that “console.log” will create an App Services log entry: [Function logging](

  • Within the Atlas web IDE, my function works. Console.log messages are displayed within the “Result” tab.
    (Tried putting IDE image here, but multiple images are not allowed.)

  • I have configured the function as a GraphQL custom resolver, and it is returning the expected results.

  • Through all of this, I can find no logging within the App Services logging. There is nothing from the custom resolver function. I see that there are previous log entries for GraphQL, and I’ve been running lots of GraphQL queries both with and without the custom resolver over the last couple of days. I’m seeing nothing. (I have played with, cleared log filters, with no luck.)

Under what conditions does App Services (not) create log entries? How can one log information from a custom resolver function? Is there clear documentation for this somewhere (a link)?

Hi there,

App Services stores each output as a single string in the log entry’s Logs field.

I tested whether that appears in the logs by query against endpoint and console logging the request itself and it works fine, if you press on the arrow under the status tab you find:


  "[object Object]"

If you want the whole object there are tricks out there (maybe JSON.stringify(JSON.parse(obj))) , otherwise you can still log values.


@santimir Thanks for your response. Can you give me a few more details? Query against which endpoint? The app services logging endpoint? “Status” tab where?

1 Like

You are welcome.

  • The status column header in your image and then click in any chevron sign.
  • By endpoint I just mean the function that is console logging

@santimir Thanks for your response. Ok–gotcha on the status, chevron, and endpoint. However, I simply do not have any events on which to click. I have been working all day today (Dec 28) with my custom resolver function (presumably doing its console.logs), and I don’t have a single entry in the App Service log (“Logs” menu option) for today.

Im afraid I dont know much more (only exploring just as you do.)

But hopefully some more experienced users will come for rescue :slight_smile:

Submitted support ticket to MongoDB. Received response from David Griffith:

When running functions from the Atlas > App Services > Functions Page UI, logs are not written to the App Services Logs, but instead they write directly to the console on the Functions Page UI. However, when running functions “normally”, for instance, from a trigger, html endpoint, or via an SDK, logs are written to the App Services Logs.

Likewise, when running Custom Resolvers from the Atlas > App Services > GraphQL Page UI, logs are not written to the App Services Logs. This is presumably because these are tests and you can see the results in the GraphQL Page UI. However, when running the Custom Resolver normally, a log entry is written to the App Services Logs.

I have verified that calling from Postman produces the expected log entries.

To me, the essential conclusion is “To test GraphQL custom resolver functions using the log, you must call the GraphQL endpoint with Postman or similar tool. You cannot use the Atlas GraphQL UI.”