Unsupported `__op` value in a write request returns HTTP 500

Offen Anfängerfreundlich
#10,841 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@RagedPanda arbeitet bereits daran.

Seit 29.10.2026.

  • #10844 von @RagedPanda — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
78/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
javascript, mongodb, nodejs, postgres
Bereich
api, backend, databases

Rechercherichtung

Beginne mit dem Lesen von SchemaController.getObjectType und verfolge, wie Schreibanfragen Operationsobjekte validieren, bevor sie die Storage-Adapter erreichen. Prüfe die vorhandenen Adapterfehler und zugehörigen Tests auf nicht unterstützte __op-Werte. Als erledigt gilt die Arbeit, wenn Create- und Update-Anfragen mit SetOnInsert oder einem unbekannten Operator einen Clientfehler zurückgeben, der den nicht unterstützten Operator nennt, statt HTTP 500.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

New Issue Checklist
Issue Description

A create or update whose field value is an operation object with an __op value that the REST API does not support returns HTTP 500 instead of a client error. This applies to SetOnInsert, which #8791 added for the server-side database API only, and to any unknown operator name.

SchemaController.getObjectType throws a plain string ('unexpected op: <name>') for an operator it does not know. The thrown value is not an Error, so it reaches the client as Internal server error and is logged without a message. The storage adapters reject such operators with a Parse error (COMMAND_UNAVAILABLE, "The operator is not supported yet."), but schema validation runs first and never gets there.

Steps to reproduce
  1. POST /classes/Thing with body {"counter": {"__op": "SetOnInsert", "amount": 1}}.
  2. PUT /classes/Thing/<objectId> with the same body.
  3. Either request with {"counter": {"__op": "Foo"}}.

All with the master key; the behavior is independent of ACL and class-level permissions.

Actual Outcome

HTTP 500 with {"code": 1, "message": "Internal server error."}. The server logs Uncaught internal server error. with no message or stack, because a string was thrown.

Expected Outcome

A client error that names the unsupported operator, for example HTTP 400 with Parse.Error.COMMAND_UNAVAILABLE (code 108) as the storage adapters already return, or Parse.Error.INCORRECT_TYPE (code 111). No HTTP 500.

Environment

Server

  • Parse Server version: 9.10.7
  • Operating system: macOS
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): MongoDB (the error occurs in schema validation before the storage adapter, so Postgres is expected to behave the same)
  • Database version: 8.0
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): REST API
  • SDK version: n/a
Logs
error: Uncaught internal server error.
Vorherrschende Sprache
JavaScript
Sterne
21.4k
Forks
4.8k
Ø Merge
7 Std. 8 Min.
Gemergte PRs (30 T.)
65

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus parse-community/parse-server

Alle Issues in parse-community/parse-server

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.