I have…
- [X] Read the following guideline: https://docs.squidex.io/01-getting-started/installation/troubleshooting-and-support. I understand that my support request might get deleted if I do not follow the guideline.
I’m submitting a…
- [ ] Regression (a behavior that stopped working in a new release)
- [X] Bug report
- [ ] Performance issue
- [ ] Documentation issue or request
Minimal reproduction of the problem
I have this content form:
Markets, Countries and Languages are references to other schemas. A market contains id, name and a list of country references and a country contains id, name and a list of language references. Language contains only id and name.
The idea is that when you select some markets and save, the related countries and languages should be checked automatically. The user should also be able to check countries (without markets) and the languages should also check automatically after saving.
This is the schema:
"properties": {
"validateOnPublish": false
},
"scripts": {
"create": "if (ctx.data.markets.iv !== null){\r\n getReferences(ctx.data.markets.iv, callbackcountries);\r\n}\r\nelse if (ctx.data.countries.iv !== null){\r\n ctx.data.markets.iv = null;\r\n getReferences(ctx.data.countries.iv, callbacklanguages);\r\n}\r\n\r\nfunction callbackcountries(result){\r\n var countries = [];\r\n for (var j = 0; j < result.length;j++){\r\n for(var i = 0; i < result[j].data.countries.iv.length;i++){\r\n if (!countries.includes(result[j].data.countries.iv[i])){\r\n countries.push(result[j].data.countries.iv[i]);\r\n }\r\n }\r\n }\r\n ctx.data.countries.iv = [];\r\n ctx.data.countries.iv = countries;\r\n \r\n getReferences(countries, callbacklanguages);\r\n}\r\n\r\nfunction callbacklanguages(result){\r\n if (ctx.data.languageSelection.iv !== 'Custom'){\r\n var languages = [];\r\n for (var c = 0; c < result.length;c++){\r\n for(var d = 0; d < result[c].data.languages.iv.length;d++){\r\n if (!languages.includes(result[c].data.languages.iv[d])){\r\n languages.push(result[c].data.languages.iv[d]);\r\n }\r\n } \r\n }\r\n ctx.data.languages.iv = [];\r\n ctx.data.languages.iv = languages; \r\n }\r\n replace();\r\n}",
"update": "if (ctx.data.markets.iv !== null){\r\n getReferences(ctx.data.markets.iv, callbackcountries);\r\n}\r\nelse if (ctx.data.countries.iv !== null){\r\n ctx.data.markets.iv = null;\r\n getReferences(ctx.data.countries.iv, callbacklanguages);\r\n}\r\n\r\nfunction callbackcountries(result){\r\n var countries = [];\r\n for (var j = 0; j < result.length;j++){\r\n for(var i = 0; i < result[j].data.countries.iv.length;i++){\r\n if (!countries.includes(result[j].data.countries.iv[i])){\r\n countries.push(result[j].data.countries.iv[i]);\r\n }\r\n }\r\n }\r\n ctx.data.countries.iv = [];\r\n ctx.data.countries.iv = countries;\r\n \r\n getReferences(countries, callbacklanguages);\r\n}\r\n\r\nfunction callbacklanguages(result){\r\n if (ctx.data.languageSelection.iv !== 'Custom'){\r\n var languages = [];\r\n for (var c = 0; c < result.length;c++){\r\n for(var d = 0; d < result[c].data.languages.iv.length;d++){\r\n if (!languages.includes(result[c].data.languages.iv[d])){\r\n languages.push(result[c].data.languages.iv[d]);\r\n }\r\n } \r\n }\r\n ctx.data.languages.iv = [];\r\n ctx.data.languages.iv = languages; \r\n }\r\n replace();\r\n}",
"change": ""
},
"fieldsInLists": [],
"fieldsInReferences": [],
"fields": [
{
"name": "name",
"properties": {
"isRequired": false,
"isRequiredOnPublish": false,
"isHalfWidth": false,
"fieldType": "String",
"editor": "Input",
"inlineEditable": false,
"isUnique": false,
"contentType": "Unspecified"
},
"isLocked": false,
"isHidden": false,
"isDisabled": false,
"partitioning": "invariant"
},
{
"name": "markets",
"properties": {
"isRequired": false,
"isRequiredOnPublish": false,
"isHalfWidth": false,
"fieldType": "References",
"editor": "Checkboxes",
"allowDuplicates": false,
"resolveReference": false,
"mustBePublished": false,
"schemaIds": [
"0a6f0fd4-ab34-45e9-a634-82fe67c4e296"
]
},
"isLocked": false,
"isHidden": false,
"isDisabled": false,
"partitioning": "invariant"
},
{
"name": "countries",
"properties": {
"isRequired": false,
"isRequiredOnPublish": false,
"isHalfWidth": false,
"fieldType": "References",
"editor": "Checkboxes",
"allowDuplicates": false,
"resolveReference": false,
"mustBePublished": false,
"schemaIds": [
"5c8fddfb-eeed-4bff-8492-abb57b841cd3"
]
},
"isLocked": false,
"isHidden": false,
"isDisabled": false,
"partitioning": "invariant"
},
{
"name": "languageSelection",
"properties": {
"isRequired": true,
"isRequiredOnPublish": false,
"isHalfWidth": false,
"fieldType": "String",
"editor": "Dropdown",
"inlineEditable": false,
"isUnique": false,
"defaultValue": "All selected geography languages",
"allowedValues": [
"All selected geography languages",
"Custom"
],
"contentType": "Unspecified",
"label": "",
"hints": "",
"placeholder": ""
},
"isLocked": false,
"isHidden": false,
"isDisabled": false,
"partitioning": "invariant"
},
{
"name": "languages",
"properties": {
"isRequired": false,
"isRequiredOnPublish": false,
"isHalfWidth": false,
"fieldType": "References",
"editor": "Checkboxes",
"allowDuplicates": false,
"resolveReference": false,
"mustBePublished": false,
"schemaIds": [
"92eb8529-17d3-4afe-b9f6-5ff840d5c6c2"
]
},
"isLocked": false,
"isHidden": false,
"isDisabled": false,
"partitioning": "invariant"
}
],
"isPublished": true
}
The script works perfectly in the first tests I did in cloud to check how Squidex worked, but it doesn’t work in our self hosted environment with Docker. It only fails when we check markets (two getReferences are called), but if we only check countries it works fine. The error says “Failed to create content. Please reload”.
I checked Bug report because I thought it was the most suitable option, but maybe I’m doing something wrong. Do you know where could be the problem?
Thanks a lot!
Environment
- [X] Self hosted with docker
- [ ] Self hosted with IIS
- [ ] Self hosted with other version
- [ ] Cloud version
Version: [VERSION]
Browser:
- [X] Chrome (desktop)
- [ ] Chrome (Android)
- [ ] Chrome (iOS)
- [ ] Firefox
- [ ] Safari (desktop)
- [ ] Safari (iOS)
- [ ] IE
- [ ] Edge