parse-community / parse-community/parse-dashboard
Custom FileAdapter breaks dashboard
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
When adding a custom FileAdapter (works as expected) in parse-server it generated a server error in the dashboard.
"TypeError: Converting circular structure to JSON"
This seems to be the reason:

Environment Setup
node 13.0.1
npm 6.13.1
parse-dashboard 2.0.5
parse-server 4.2.0
Steps to reproduce
Add a custom fileAdapter that uses mongodb client to parse-server.
The most basic example:
ImageGridFSBucketAdapter.js
const { GridFSBucketAdapter } = require('parse-server/lib/Adapters/Files/GridFSBucketAdapter');
module.exports = class ImageGridFSBucketAdapter extends GridFSBucketAdapter {
constructor(mongoDatabaseURI, mongoOptions = {}) {
super(mongoDatabaseURI, mongoOptions);
}
};
Where you start the parse-server:
const ImageGridFSBucketAdapter = require('./adapters/ImageGridFSBucketAdapter');
const config = {
...
filesAdapter: new ImageGridFSBucketAdapter(config.databaseURI),
...
};
const parse = ParseServer.start(config, async () => {
...
});
(the same thing happens when you just copy the GridFSBucketAdapter instead of extending it)
Than load the dashboard, upload file using the dashboard (or your api) and refresh the dashboard.
Logs/Trace
Note: If you get a browser JS error please run npm run dev. This will provide source maps and a much more useful stack trace.
In the parse-server log and in the network request for http://localhost:1337/dashboard/parse-dashboard-config.json
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'NativeTopology'
| property 's' -> object with constructor 'Object'
| property 'sessionPool' -> object with constructor 'ServerSessionPool'
--- property 'topology' closes the circle
at JSON.stringify ()
at stringify (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/response.js:1123:12)
at ServerResponse.json (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/response.js:260:14)
at /Users/wolfwood/dev/project-name/packages/apps/api/node_modules/parse-dashboard/Parse-Dashboard/app.js:133:20
at Layer.handle [as handle_request] (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/layer.js:95:5)
at /Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/index.js:335:12)
at next (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/index.js:275:10)
at Layer.handle [as handle_request] (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/layer.js:91:12)
at trim_prefix (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/index.js:317:13)
at /Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/index.js:335:12)
at next (/Users/wolfwood/dev/project-name/packages/apps/api/node_modules/express/lib/router/index.js:275:10)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Parse-Dashboard/app.js around the response for /dashboard/parse-dashboard-config.json, using the reported JSON.stringify stack trace as the entry point. Reproduce with the custom GridFSBucketAdapter and check how its MongoDB client state reaches the dashboard response; done means the dashboard loads and refreshes after a file upload without the circular-structure error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100