Skip to content
This repository was archived by the owner on Oct 4, 2022. It is now read-only.
This repository was archived by the owner on Oct 4, 2022. It is now read-only.

Problem with res.send of a MongoDB-ObjectID #16

@mm765

Description

@mm765

Hi,
i am having a problem with res.send() in decaf/modules/http/lib/Response.js

So far, everything worked, while ive been requesting files and some very simple json-data (like a login request returning if the user/password combination is valid).

Now i tried requesting/returning some data from the database (simple stuff - id (Objectid), username and language-code)
and i get an internal server error.
After about 2-3 hours of searching, i found out that the problem is the ObjectId - as soon as it is in the data that is being sent, the error happens, if i dont send it, no error.

the stacktrace:
Stack Trace
InternalError: Java class "[Ljava.lang.reflect.Constructor;" has no public instance field or method named "toJSON". (/usr/local/decaf/modules/http/lib/Response.js#185)
at /usr/local/decaf/modules/http/lib/Response.js:178 (anonymous)
at /opt/itk/modules/UserHandler.js:38 (anonymous)
at /opt/itk/modules/UserHandler.js:12 (anonymous)
at /opt/itk/libs/decaf-jolt/lib/Application.js:233 (anonymous)
at /opt/itk/libs/decaf-jolt/lib/Application.js:170 (anonymous)
at /usr/local/decaf/modules/http/lib/Child.js:69 (handleRequest)
at /usr/local/decaf/modules/http/lib/Child.js:102 (Child)
at /usr/local/decaf/modules/Threads/lib/Thread.js:197 (anonymous)

interestingly it shows the error happening in line 178 whereas, when i use the debugger, the error happens in line 182 of Response.js (which makes sense because i'm sending json-data, not text).
.
Please advise/help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions