You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user on v2023.3.1 tried to use contains() in the OData $filter query parameter, which resulted in an error in Sentry. We don't support the OData contains() function, which causes methodCall() in odata-filter.js to return undefined, then I think odataFilter() as a whole to return undefined:
// n.b. odata-v4-parser appears to already validate function name and arity.
constlowerName=fn.toLowerCase();
if(extractFunctions.includes(lowerName))
returnsql`extract(${raw(lowerName)} from ${op(params[0])})`;// eslint-disable-line no-use-before-define
elseif(fn==='now')
returnsql`now()`;
};
Slonik then throws an error about passing undefined to a sql`` template string:
InvalidInputError: SQL tag cannot be bound an undefined value.
File "/usr/odk/node_modules/slonik/dist/src/factories/createSqlTag.js", line 27, col 19, in sql
throw new errors_1.InvalidInputError('SQL tag cannot be bound an undefined value.');
File "/usr/odk/lib/model/query/submissions.js", line 309, col 13, in _export
return sql`
File "/usr/odk/lib/model/query/submissions.js", line 348, col 10, in <anonymous>
stream(_export(formId, draft, keyIds, options))
File "/usr/odk/lib/model/container.js", line 30, col 33, in Object.module.<computed> [as streamForExport]
const result = fn(...args)(container);
File "/usr/odk/lib/resources/odata.js", line 68, col 25, in <anonymous>
Submissions.streamForExport(form.id, draft, undefined, options),
File "/usr/odk/node_modules/slonik/dist/src/factories/createSqlTag.js", in runMicrotasks
File "node:internal/process/task_queues", line 96, col 5, in processTicksAndRejections
Instead of returning undefined, I think odataFilter() should throw an OData-related Problem if passed a function that it doesn't support. We throw a Problem in other cases in which we aren't able to handle the filter expression.
The text was updated successfully, but these errors were encountered:
A user on v2023.3.1 tried to use
contains()
in the OData$filter
query parameter, which resulted in an error in Sentry. We don't support the ODatacontains()
function, which causesmethodCall()
in odata-filter.js to returnundefined
, then I thinkodataFilter()
as a whole to returnundefined
:central-backend/lib/data/odata-filter.js
Lines 27 to 34 in 83e4533
Slonik then throws an error about passing
undefined
to asql``
template string:Instead of returning
undefined
, I thinkodataFilter()
should throw an OData-related Problem if passed a function that it doesn't support. We throw a Problem in other cases in which we aren't able to handle the filter expression.The text was updated successfully, but these errors were encountered: