Error during userFindManyRecords for .... Response not successful: received status code 400
Hi Twenty team, thanks for the great software.
I am self hosting via docker and the product has been generally working great! However, I have run in to an error customising the data model.
When editing some data model fields via the web interface, I get the error "Error during userFindManyRecords for .... Response not successful: received status code 400" appearing in the top corner of my screen, and any changes I make to the field (e.g. change the icon) are not able to be saved (the save button is greyed out). See attached figure. Attached is also the whole list of fields for this example.
I have not manually changed anything in the data base.
I have noticed this happen on a variety of fields. But I see no pattern in which fields it happens on. The error can happen in the people or companies data models, but also custom objects.
I have attached the log error, too.
Do you have any suggestions as to what the error might be and how i could fix it? I am confident to edit the DB etc if required.
65 Replies
Iβve tried simply deleting the fields and re adding them. But i canβt delete the fields, it also throws an error
Hi Rob, we had issue recently with custom object renaming
I think that's the issue you have
Could you check metadata.workspaceMigration, order by name and see if you have unapplied migrations
If yes, we will need to apply then:
- yarn command:prod workspace:apply-pending-migrations -w {your_workspace_id}
I suspect you'll see an error here. Once identified, I can help you troubleshoot, should be farily straightforward
(the bug fix has been merged on main and will be part of the next release end of the week)
Thanks for the help @charles
I looked at metadata.workspaceMigration and all rows have an appliedAt timestamp, does that mean that the migrations had been applied?
Regardless, I ran the commands for my two workspaces
-
docker exec -it home-server_twenty_1 yarn command:prod workspace:apply-pending-migrations -w 9f7ecf08-68ee-4c75-83b8-6e5716601558
- docker exec -it home-server_twenty_1 yarn command:prod workspace:apply-pending-migrations -w 6e278d07-a88a-45d3-86c9-daea30a9b0e5
Neither command seemed to throw an error, I have attached the output.
I still see the error occuring. Have I applied your suggestion correctly? Is there anything else I can try? Thanks again!!ok, so that's not it!
what do you see in your server logs ?
where do i find the server logs? Is that the same as the docker container logs? Or something else?
yes they should be in the output
Thanks @charles
I have captured the logs and will DM it to you (contains domain names etc, so slightly sensitive). I also captured some screenshots and attach them here.
Here is what I did:
- Relaunched server
- Opened Companies page
- Opened People page
- Opened a person, then viewed a note
- Clicked on settings
- Clicked on Data Model
- Went to an object called fund prospects
- Tried to delete an inactive field (failed with ORM Error)
- Renamed "fund prospects" to "deal flow" (got an error)
- Reloaded the Data Models page (shows error)
Thanks for your help! I'd love to fix whatever I've broken. I really like using Twenty, it's a great product!
I suspect it has something to do with the multi select items. I deleted my db and docker images and started fresh. And I start seeing errors once i've created multi select fields.
Ok, I am pretty sure its something to do with multi select. I just ran the following experiment:
- Started with fresh db using the twenty-postgres image
- Started the twenty docker image
- Ran
docker exec -it twenty_1 yarn
- Ran docker exec -it twenty_1 npx nx database:reset
- Logged in to the demo workspace
- Created a test multi select field in the people data model, added option 1, option 2, option 3
- Clicked back in to settings, then data model, then people, then test field
- Error appears in red, and I have attached the log.
Does this help @charles ?I just switch to
twentycrm/twenty-postgres:main
and twentycrm/twenty:main
and the same thing happens still> I took a screen recording and grab the logs again incase that helpsHi Rob, these are the server logs indeed π
the logs you have sent in private surface an issue about DealFlow object, the last one you've attached here are related to a multi select issue
so maybe i have multiple issues, sorry π¦
should we split up the discussion? should i open another thread for the multi select issue?
No worries, we have a few bugs that are fixed on main but not in the latest release yet
It's fine to discuss them together here
so, first, let's make sure you don't have any pending migrations not applied again
could you check your metadata.workspaceMigration table to see if there is any line with appliedAt null?
i think the multi select is still an issue on main, i tested that too. But I am happy to move to main if you think it might have some unsolved bugs?
moving on main will prevent you to break your schema but your schema is already broken so we need to fix it
It's better that you keep using official releases, main is unstable
Let's fix your schema and I'll draft a new patch release in the mean time (on 0.11.x)
alright, thanks
ok, let me check the db
please give me a few min, i need to restore the db. i moved to a clean workspace while trying to debug the multi issue
sure π
ok, i am back up and running
first, i will check the metadata.workspaceMigration
all of the appliedAt have a datetime associated with them
ok
so it's not as broken as I tought :p
do you have a dealFlow object in metadata.objectMetadata ? (nameSingular)
Now, this might be annoying/confusing, but I renamed the object while trying to debug this issue.
I think that's part of the issue yes π we have temporariliy (and by mistake) allow object renaming in the UI which is actually not supported by the engine
but we can fix it easily
oh, nice!
thanks so much
we should make sure that whatever you have in metadata.objectMetadata singularName matches your table names in your postgres workspace_xxx schema
ok, we can do that
is it worth me clicking through the interface to determine where the errors occur again? or just jump stratight to the db?
straight to db π
lets do it
ok, ihave 60 rows in metadata.objectMetadata
check the one associated to your workspaceId (you might have multiple workspaces included the demo one)
we are looking for an objectMetadata with nameSingular dealFlow
none of them have the nameSingular dealFlow, i have restored to before that name change was made. Here is the current error I am getting
these errors are "ok", we are fixing them in 0.12 but it's not your issue
FYI, I am also fine to delete the propsects/deal flow objects and just fix the person and company objects.
mmm
could you browse the company page again? and see what error you have in the server logs
I don't get why you don't have the dealFlow issue but let's move on π
(let's ignore these orderBy issues)
I reverted to before I renamed the object
ok!
got ya! will do
if you don't have any data in dealFlow
it's better that you delete the customObject
(or whatever the previous name is)
done!
great
let's browse the app again (Companies / people page) and see if you have any other error
doing it now
(just deleted all my custom objects)
can i delete the opportunities object, or does that have some special code/functionality (like people and company does)?
you should not be able to delete the opportuniy object
you are deleting from the UI right? :p
i am deleting from the ui
great!
so you can't delete Opportunity because it's a Standard Object
you can only deactivate it
correct, you can only deactivate the opporunitiy
ok
i think the only issues i am getting now is related to multi select and the orderBy
ok!
could you post the multi-select error log again?
will do. please hold on while i collect that error...
I think its the same as the order by maybe???
[
InternalServerErrorException: GraphQL errors on person: {"message":"Input for type personOrderBy contains extra keys ["country"]"}
at computePgGraphQLError (/app/packages/twenty-server/dist/src/engine/api/graphql/workspace-query-runner/utils/compute-pg-graphql-error.util.js:29:12)
at WorkspaceQueryRunnerService.parseResult (/app/packages/twenty-server/dist/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.js:275:80)
at WorkspaceQueryRunnerService.findMany (/app/packages/twenty-server/dist/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.js:60:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async field.resolve (/app/node_modules/@envelop/on-resolve/cjs/index.js:36:42)
at async /app/node_modules/@graphql-tools/executor/cjs/execution/promiseForObject.js:18:35
at async Promise.all (index 0) {
path: [ 'people' ],
locations: [ [Object] ],
extensions: [Object: null prototype] {}
}
]
nope! These queries are failing indeed but they are triggered when browsing the Settings > Data Model
correct, that was when i browsed the data model
we are doing a sortBy relationName which we should not do :p
i tried to add another option to the multi
but i am able to add more options to the multi select in the data model
so, functionality is now all working for me
ok!
i have some errors appearing, as above, but are you saying i should ignore them and it will be fixed in upcoming releases?
yep, in 0.12
amazing, thank you so much for your time
let's check your workspace health
and then you are good to go
please, lets do it!
can you connect to your container
done!
yarn command:prod workspace:health -w {yourWorkspaceId} -d
cat logs/workspace-health-command/workspace-health-issues-xxx.json
you should have ~3 errors
11 issues and i cant cat
ops
can cat
want me to paste to you the long cat output?
yep π
sending in DM
it was too long for me to capture using the portainer. i can try and log in via command line, let me google how to do that
in
it's all right!
looks fine!
great. I will close this as solved, thanks charles
π