postgraphile-plugin-upload-field icon indicating copy to clipboard operation
postgraphile-plugin-upload-field copied to clipboard

RangeError: Maximum call stack size exceeded

Open ltamrazov opened this issue 4 years ago • 0 comments

Hi,

Originally mistakingly filed this under the example repo, closed that issue since.

First of thank you for the work on this plugin! This error is a result of a unique combination of plugins, so could be an edge case, nevertheless here I go:

We use this plugin as well as with https://github.com/mlipscombe/postgraphile-plugin-fulltext-filter. The issue is that the fulltext-filter plugin modifies the args to replace the type on the tsvector columns with a deeply nested object (it contains tokenization information).

As a result, when we update a field of type tsvector (that is manipulated by that plugin) postgraphile-upload exceeds max stack when it dives into it: RangeError: Maximum call stack size exceeded. We feel this is a bug because in this case we are not even trying to upload a file, but the plugin is preventing an update on a different unrelated fields.

I'm not sure what the solution would be, we thought of two options:

  • Move on when recursion reaches a certain depth
  • Provide an option to black list certain fields in which case the plugin would not even dive into them to begin with

The object that is we are attempting to update is like:

{
    block:false,
    kind:'StringValue',
    // this is the key that causes max call stack, since both startToken and endToken are deeply nested,
    loc:Loc {start: 86, end: 107, startToken: Tok, endToken: Tok, source: Source},
    value:'abl:368 accommod:81',
}

Thank you!

ltamrazov avatar Oct 15 '20 21:10 ltamrazov