Fix circular JSON error in error handling and empty query in findRecords#1
Open
neilwjsimpson wants to merge 1 commit intomaxpetrusenko:mainfrom
Open
Conversation
… findRecords
Two bugs fixed:
1. Error handlers included `error.response` (full Axios response object) in
debug log objects, then called JSON.stringify on them. Axios response objects
contain circular references (ClientRequest <-> IncomingMessage), causing
"Converting circular structure to JSON" to be thrown inside catch blocks,
masking the original error. Fixed by extracting only serializable properties
(data, status) and wrapping the stringify in a try/catch safety net.
2. findRecords sent an empty query array [] to the _find endpoint when no
query was provided. The FileMaker Data API rejects empty query arrays.
Fixed by using GET /layouts/{layout}/records (list all records) when no
query is specified, and POST _find only when a query is provided.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
error.response(full Axios response object with circular refsClientRequest<->IncomingMessage) was included in debug log objects and passed toJSON.stringify, throwing "Converting circular structure to JSON" inside catch blocks and masking the original error. Fixed by extracting only serializable properties (data,status) and wrapping stringify in a safety net.findRecords: When called without a query, an empty array[]was sent to the_findendpoint, which FileMaker rejects. Fixed by routing toGET /layouts/{layout}/recordswhen no query is provided.Test plan
fm_find_recordswith a layout name and no query — should return records instead of crashingfm_find_recordswith a layout name and a query — should still use_findendpoint correctly🤖 Generated with Claude Code