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
Describe the bug
When returning an error message (or throwing an exception) all text in the message is stripped up until the first colon :. Subsequent colons are replaced with a .
To Reproduce
Steps to reproduce the behavior:
Add following custom field to the config:
config.customFields.Product.push({
name: 'sustainabilityClass',
label: [
{
languageCode: LanguageCode.en,
value: 'Sustainability class',
},
],
type: 'string',
validate: () =>
'All text before the first colon: removed but after: replaced by a dot',
});
Run the server and go to ADMIN UI and for a product try to update the sustainabilityClass custom field, response:
Expected behavior
The server should return the unmodified version of the error message.
Environment (please complete the following information):
@vendure/core version: 1.9.5
Nodejs version: v16.19.0
Database (mysql/postgres etc): Postgres
Additional context
When throwing an exception in onTransitionStart when transitioning an order the same thing happens with the Error text propagated through the GraphQL API. It is stripped until the first ':' and subsequent colons are replaced with a dot ..
The text was updated successfully, but these errors were encountered:
Describe the bug
When returning an error message (or throwing an exception) all text in the message is stripped up until the first colon
:
. Subsequent colons are replaced with a.
To Reproduce
Steps to reproduce the behavior:
sustainabilityClass
custom field, response:Response from developer tools
{ "errors": [{ "stack": "Error: All text before the first colon: removed but after: replaced by a dot\n at validateCustomFunction (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/common/validate-custom-field-value.ts:77:19)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async Object.validateCustomFieldValue (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/common/validate-custom-field-value.ts:43:5)\n at async ValidateCustomFieldsInterceptor.validateCustomFieldsObject (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/middleware/validate-custom-fields-interceptor.ts:124:17)\n at async ValidateCustomFieldsInterceptor.validateInput (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/middleware/validate-custom-fields-interceptor.ts:92:17)\n at async ValidateCustomFieldsInterceptor.intercept (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/middleware/validate-custom-fields-interceptor.ts:62:33)", "message": " removed but after. replaced by a dot", "name": "GraphQLError", "locations": [{ "line": 2, "column": 3 }], "path": ["updateProduct"], "nodes": [{ "kind": "Field", "name": { "kind": "Name", "value": "updateProduct", "loc": { "start": 104, "end": 117 } }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input", "loc": { "start": 118, "end": 123 } }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input", "loc": { "start": 126, "end": 131 } }, "loc": { "start": 125, "end": 131 } }, "loc": { "start": 118, "end": 131 } }], "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "ProductDetail", "loc": { "start": 142, "end": 155 } }, "directives": [], "loc": { "start": 139, "end": 155 } }, { "kind": "Field", "name": { "kind": "Name", "value": "variantList", "loc": { "start": 160, "end": 171 } }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "options", "loc": { "start": 172, "end": 179 } }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "variantListOptions", "loc": { "start": 182, "end": 200 } }, "loc": { "start": 181, "end": 200 } }, "loc": { "start": 172, "end": 200 } }], "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "items", "loc": { "start": 210, "end": 215 } }, "arguments": [], "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "ProductVariant", "loc": { "start": 229, "end": 243 } }, "directives": [], "loc": { "start": 226, "end": 243 } }, { "kind": "Field", "name": { "kind": "Name", "value": "__typename", "loc": { "start": 252, "end": 262 } }, "arguments": [], "directives": [], "loc": { "start": 252, "end": 262 } }], "loc": { "start": 216, "end": 270 } }, "loc": { "start": 210, "end": 270 } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalItems", "loc": { "start": 277, "end": 287 } }, "arguments": [], "directives": [], "loc": { "start": 277, "end": 287 } }, { "kind": "Field", "name": { "kind": "Name", "value": "__typename", "loc": { "start": 294, "end": 304 } }, "arguments": [], "directives": [], "loc": { "start": 294, "end": 304 } }], "loc": { "start": 202, "end": 310 } }, "loc": { "start": 160, "end": 310 } }, { "kind": "Field", "name": { "kind": "Name", "value": "__typename", "loc": { "start": 315, "end": 325 } }, "arguments": [], "directives": [], "loc": { "start": 315, "end": 325 } }], "loc": { "start": 133, "end": 329 } }, "loc": { "start": 104, "end": 329 } }], "source": { "body": "mutation UpdateProduct($input: UpdateProductInput!, $variantListOptions: ProductVariantListOptions) {\n updateProduct(input: $input) {\n ...ProductDetail\n variantList(options: $variantListOptions) {\n items {\n ...ProductVariant\n __typename\n }\n totalItems\n __typename\n }\n __typename\n }\n}\n\nfragment ProductDetail on Product {\n id\n createdAt\n updatedAt\n enabled\n languageCode\n name\n slug\n description\n featuredAsset {\n ...Asset\n __typename\n }\n assets {\n ...Asset\n __typename\n }\n translations {\n id\n languageCode\n name\n slug\n description\n __typename\n }\n optionGroups {\n ...ProductOptionGroup\n __typename\n }\n facetValues {\n id\n code\n name\n facet {\n id\n name\n __typename\n }\n __typename\n }\n channels {\n id\n code\n __typename\n }\n customFields {\n upsellVariants {\n enabled\n trackInventory\n stockOnHand\n stockAllocated\n outOfStockThreshold\n useGlobalOutOfStockThreshold\n id\n productId\n createdAt\n updatedAt\n languageCode\n sku\n name\n price\n currencyCode\n priceWithTax\n stockLevel\n __typename\n }\n dimensionsCm\n dimensionsInch\n numberOfPhotos\n numberOfCards\n sustainabilityClass\n paperTypeClass\n finishingClass\n __typename\n }\n __typename\n}\n\nfragment ProductOptionGroup on ProductOptionGroup {\n id\n createdAt\n updatedAt\n code\n languageCode\n name\n translations {\n id\n languageCode\n name\n __typename\n }\n __typename\n}\n\nfragment Asset on Asset {\n id\n createdAt\n updatedAt\n name\n fileSize\n mimeType\n type\n preview\n source\n width\n height\n focalPoint {\n x\n y\n __typename\n }\n __typename\n}\n\nfragment ProductVariant on ProductVariant {\n id\n createdAt\n updatedAt\n enabled\n languageCode\n name\n price\n currencyCode\n priceWithTax\n stockOnHand\n stockAllocated\n trackInventory\n outOfStockThreshold\n useGlobalOutOfStockThreshold\n taxRateApplied {\n id\n name\n value\n __typename\n }\n taxCategory {\n id\n name\n __typename\n }\n sku\n options {\n ...ProductOption\n __typename\n }\n facetValues {\n id\n code\n name\n facet {\n id\n name\n __typename\n }\n __typename\n }\n featuredAsset {\n ...Asset\n __typename\n }\n assets {\n ...Asset\n __typename\n }\n translations {\n id\n languageCode\n name\n __typename\n }\n channels {\n id\n code\n __typename\n }\n customFields {\n upsellVariantsOverride {\n enabled\n trackInventory\n stockOnHand\n stockAllocated\n outOfStockThreshold\n useGlobalOutOfStockThreshold\n id\n productId\n createdAt\n updatedAt\n languageCode\n sku\n name\n price\n currencyCode\n priceWithTax\n stockLevel\n __typename\n }\n numberOfPhotosOverride\n numberOfCardsOverride\n dimensionsCmOverride\n dimensionsInchOverride\n productSpecs\n __typename\n }\n __typename\n}\n\nfragment ProductOption on ProductOption {\n id\n createdAt\n updatedAt\n code\n languageCode\n name\n groupId\n translations {\n id\n languageCode\n name\n __typename\n }\n __typename\n}\n", "name": "GraphQL request", "locationOffset": { "line": 1, "column": 1 } }, "positions": [104], "originalError": { "stack": "Error: All text before the first colon: removed but after: replaced by a dot\n at validateCustomFunction (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/common/validate-custom-field-value.ts:77:19)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async Object.validateCustomFieldValue (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/common/validate-custom-field-value.ts:43:5)\n at async ValidateCustomFieldsInterceptor.validateCustomFieldsObject (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/middleware/validate-custom-fields-interceptor.ts:124:17)\n at async ValidateCustomFieldsInterceptor.validateInput (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/middleware/validate-custom-fields-interceptor.ts:92:17)\n at async ValidateCustomFieldsInterceptor.intercept (/home/pieter/projects/ecommerce-engine/node_modules/@vendure/core/src/api/middleware/validate-custom-fields-interceptor.ts:62:33)", "message": "All text before the first colon: removed but after: replaced by a dot", "extensions": { "code": "USER_INPUT_ERROR" }, "code": "USER_INPUT_ERROR", "logLevel": 1 }, "extensions": { "code": "USER_INPUT_ERROR" } }], "data": null }Expected behavior
The server should return the unmodified version of the error message.
Environment (please complete the following information):
Additional context
When throwing an exception in
onTransitionStart
when transitioning an order the same thing happens with the Error text propagated through the GraphQL API. It is stripped until the first ':' and subsequent colons are replaced with a dot.
.The text was updated successfully, but these errors were encountered: