SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
807 stars 171 forks source link

InvalidArgumentException while Running Patch. Document is updated though #232

Closed genxlogics closed 7 years ago

genxlogics commented 7 years ago

Hi All, I am running PATCH /cache/vehicles/1122334455 { "$addToSet":{ "addresses":{ "addressType" : "N", "line2":"line 2" } } }

the document doesnt exist. but the query inserts the document and creates an array with the document. but while responding back it returns as

{ "_exceptions": [ { "exception": "java.lang.IllegalArgumentException", "exception message": "Invalid response code" } ], "http status code": 500, "http status description": "Internal Server Error", "message": "Error handling the request, see log for more information" }

i can clearly see that document is created. when i run the query next time for same document it works fine.

please help me.

Exception stack trace

java.lang.IllegalArgumentException: Invalid response code at io.undertow.server.HttpServerExchange.setStatusCode(HttpServerExchang e.java:1370) at org.restheart.handlers.ResponseSenderHandler.handleRequest(ResponseSe nderHandler.java:113) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.metadata.HookMetadataHandler.handleRequest(Hoo kMetadataHandler.java:104) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.metadata.TransformerHandler.handleRequest(Tran sformerHandler.java:70) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.metadata.AbstractTransformerMetadataHandler.ha ndleRequest(AbstractTransformerMetadataHandler.java:62) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.metadata.AfterWriteCheckMetadataHandler.handle Request(AfterWriteCheckMetadataHandler.java:130) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.document.PatchDocumentHandler.handleRequest(Pa tchDocumentHandler.java:173) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.metadata.BeforeWriteCheckMetadataHandler.handl eRequest(BeforeWriteCheckMetadataHandler.java:79) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.metadata.AbstractTransformerMetadataHandler.ha ndleRequest(AbstractTransformerMetadataHandler.java:62) at org.restheart.handlers.RequestDispacherHandler.handleRequest(RequestD ispacherHandler.java:468) at org.restheart.handlers.injectors.CollectionPropsInjectorHandler.handl eRequest(CollectionPropsInjectorHandler.java:98) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.injectors.DbPropsInjectorHandler.handleRequest (DbPropsInjectorHandler.java:92) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.injectors.AccountInjectorHandler.handleRequest (AccountInjectorHandler.java:56) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.security.handlers.AccessManagerHandler.handleRequest(Ac cessManagerHandler.java:55) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.security.handlers.AuthTokenInjecterHandler.handleReques t(AuthTokenInjecterHandler.java:70) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.security.handlers.AuthenticationCallHandler.handleReque st(AuthenticationCallHandler.java:54) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.security.handlers.AuthenticationConstraintHandler.handl eRequest(AuthenticationConstraintHandler.java:55) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.security.handlers.AuthenticationMechanismsHandler.handl eRequest(AuthenticationMechanismsHandler.java:61) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.security.handlers.SecurityInitialHandler.handleRequest( SecurityInitialHandler.java:85) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.security.handlers.SecurityHandler.handleRequest(Securit yHandler.java:50) at org.restheart.security.handlers.SecurityHandlerDispacher.handleReques t(SecurityHandlerDispacher.java:60) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.injectors.BodyInjectorHandler.handleRequest(Bo dyInjectorHandler.java:336) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.OptionsHandler.handleRequest(OptionsHandler.ja va:58) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.handlers.injectors.RequestContextInjectorHandler.handle Request(RequestContextInjectorHandler.java:647) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:13 6) at org.restheart.security.handlers.CORSHandler.handleRequest(CORSHandler .java:88) at org.restheart.handlers.RequestLoggerHandler.handleRequest(RequestLogg erHandler.java:87) at org.restheart.handlers.PipedHttpHandler.handleRequest(PipedHttpHandle r.java:89) at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.jav a:94) at io.undertow.server.handlers.HttpContinueAcceptingHandler.handleReques t(HttpContinueAcceptingHandler.java:78) at org.restheart.handlers.ErrorHandler.handleRequest(ErrorHandler.java:6 9) at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(En codingHandler.java:72) at org.restheart.handlers.GzipEncodingHandler.handleRequest(GzipEncoding Handler.java:74) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:210)

    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:8

09) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 15:13:16.492 [XNIO-1 task-4] INFO o.r.handlers.RequestLoggerHandler - PATCH htt ps://host:4443/cache/vehicles/P7G4000015 from /10.200.244.252:51801 => stat us=500 elapsed=50ms contentLength=185 username=abcd roles=[users]

ujibang commented 7 years ago

I reproduced the issue. Will be fixed asap.

Thanks for reporting

ujibang commented 7 years ago

fixed in master and 3.1.x branches. you can download automatic builds from sonatype

fix will be available in restheart 3.1.2

mkjsix commented 7 years ago

Release 3.1.2 is available https://github.com/SoftInstigate/restheart/releases/tag/3.1.2 https://hub.docker.com/r/softinstigate/restheart/tags/