parse-community / parse-community/parse-server

fix: API response of metadata handler on invalid app ID is different from the file get handler

Open
#10,108 1 comment 0 reactions 1 assignee View on GitHub

@mtrezza is already working on this.

Since Mar 6, 2026.

Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

Summary

The metadataHandler in src/Routers/FilesRouter.js returns HTTP 200 with an empty JSON object ({}) when the app ID is invalid (config is missing), while getHandler returns HTTP 403 with "Invalid application ID." for the same condition. This inconsistency can mask configuration errors for callers of the metadata endpoint.

Expected behavior

metadataHandler should return HTTP 403 with an appropriate error message when the config is missing, consistent with getHandler:

       const config = Config.get(req.params.appId);
       if (!config) {
-        res.status(200);
-        res.json({});
+        const error = createSanitizedHttpError(403, 'Invalid application ID.', config);
+        res.status(error.status);
+        res.json({ error: error.message });
         return;
       }

The existing test does not crash on file metadata request with invalid app ID will need to be updated to assert the new 403 response.

Context

Identified during review of #10106 (comment: https://github.com/parse-community/parse-server/pull/10106#discussion_r2893050866). The inconsistency predates that PR and is intentionally out of scope for it.

Requested by @mtrezza.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.