Not able to log in. No metadata for User was found.
Hello, I have a strange problem with a new installation on Ubuntu v22.04. I have a new instance of the latest Twenty server v0.23.0 (a new build was made, running without problems against a standalone PostgreSQL database). Also, a client-side code was built and run in a Chrome browser. But in a moment when I want to log in using the pre-filled login name
[email protected]
, the server responses by the error message "code": "INTERNAL_SERVER_ERROR", "response": "No metadata for \"User\" was found."
.
It looks like there is no other recognizable problem. Even if I check the pre-feed database content, everything looks fine. The only thing I am aware of is that the PostgreSQL database is v14.11. Plus, there are no installed database extensions wrappers
and mysql_fdw
, but the latest pg_graphql
has been installed. Is it possible that it can have any relation to the observed problem?
The following commands were also executed, and except messages related to the missing extensions wrappers
and mysql_fdw
, no other errors.
It is worth to mention that seeding the sample database data has no effect to the described error. It is the same in both cases.
Or any other tip on where to find the source of the problem? I wanted to keep the problem description simple, but if necessary, I can add more details, including code. Thanks a lot for any help.40 Replies
Payload of the POST request
/graphql
:
If I compare our case with the exactly the same operation on https://demo.twenty.com, it is evident that in our case
captchaToken
variable is not sent as a part of the request. It is a question what is different in our case. Any idea?
Can our problem be related to the fact that the client config for the captcha is not defined? There is no information in the documentation what is necessary to do for the self-hosting case, except simply listing environment variables CAPTCHA_DRIVER, CAPTCHA_SITE_KEY, CAPTCHA_SECRET_KEY on the page https://twenty.com/developers/section/self-hosting/self-hosting-var. Is it possible to disable the captcha for self-hosting cases, especially when they are just demonstration installations? Doesn't it mean the value "provider": null
represents a disabled state?
Why would you use captcha if there's no need to use it when self-hosting unless it's self-hosted for company?
@ɃØĦɆᵾS I am trying to find any, even theoretical, possible reason as I am fighting with the
No metadata for User was found.
error. Actually, I have confirmed that the reCaptcha has no effect on our problem. Even with the same request as on https://demo.twenty.com, I am still receiving the same error when trying to log in.
@ɃØĦɆᵾS This the site URL, if you want to look: https://app-44d-3000.prg1.zerops.app
Twenty
A modern open-source CRM
Okay, so now few questions:
1. How did you exactly host app? Using 1-click deploy or local setup, if local setup, then DB is in Docker or directly on Linux?
2. Does .env in packages/twenty-server has captcha variables uncommented? (they're described as optional)
1. How did you exactly host app? Using 1-click deploy or local setup, if local setup, then DB is in Docker or directly on Linux?I have used the original Docker script to create my own local script to do all necessary steps on a Linux Ubuntu machine (container). So no Docker things are used in the end. The PostgreSQL database is running on a standalone Ubuntu container. @ɃØĦɆᵾS If it can help you, these are the steps how the Twenty server has been built: and run: As the deployed code is taken: @ɃØĦɆᵾS And these are the environment variables used to build and run:
2. Does .env in packages/twenty-server has captcha variables uncommented? (they're described as optional)I am using directly defined environment variables, not through the .env file. Initially captcha envs were not used at all. Then I tried them, but the result was the same, so I can remove them again.
Frankly speaking, I have no clue what might went wrong except for seeding workspace with data as I'm not sure if it works properly (I guess it should overwrite existing data but it doesn't?), if you don't have any important data, you can try running
npx nx database:reset twenty-server
as this creates all proper schemas and inserts needed dataAs I mentioned before, it looks that there should no be a problem, but it is. I guess that it is something really trivial, as normal.
@ɃØĦɆᵾS Can help you if I pass and access database details to you? Are you able to look at the database if it looks normal?
@ɃØĦɆᵾS What does the command
npx nx database:reset
mean in fact? As I am looking at the code, it represents the following steps. Because I am installing a fresh instance of the database (don't need ./scripts/truncate-db.ts
), and there are no historical data. Then ./scripts/setup-db.ts
is the same as "database:init:prod": "npx ts-node ./scripts/setup-db.ts && yarn database:migrate:prod"
. There is nothing to migrate.
From what I've checked:
- truncate fetches all schemas and drops them
- setup-db creates all schemas and extensions
- database:migrate does some black magic in dist/ but by looking at other files it seems like it creates all necessary data
- workspace:seed:dev is not in project.json (it's located in
src/database/commands/data-seed-demo-workspace/services
) but I'd guess it's responsible for inserting all data from src/database/typeorm-seeds
As much as I'm willing to help you solve your problem, I don't feel like I'd be able to help you more than I can do here, also, I'm not a developer by any means 😄
If I were you, I'd wait for tomorrow when someone from core team will take care of it, I'm sorry I couldn't help you moreThanks a lot for your effort anyway. Because I started with a new database instance, the truncating doesn't add anything new, and setup-db is called and finished, as expected. So the source of the problem should come from else. And, your recommendation sounds reasonable. 😻
I guess they did it so it can run on both new and existing setups in case something goes horribly wrong (like I'm doing way too often)
After all, there's no big difference in time if database is truncated or not
One thing, just to be sure, do you have records in
core."user"
?@ɃØĦɆᵾS Yes, I have checked that.
I believe that the problem is somehow related to the TypeOrm functionality.
@Brendan First, I apologize for the personal address. I am relatively new in the Twenty community and don't know Twenty's team yet, so I am a bit lost on who focuses on what area. I tried really hard to solve my problem but without success. It seems that it is somehow related to the TypeORM library, and somebody is certainly focusing on that area. I would like to ask if you can help connect me to him/her.
if it should be a problem with typeorm i think
@magrin_j
or @weiko_twenty
could know more - but i think the problem could be somewhere hidden in the manual build as for others the build is successfull ...@Brendan Thanks for the tips. I appreciate it. The manual build is a close copy of the Docker script, with minimum space to do something wrong. The
checkUserExists
function is straightforward, and it's hard to imagine that the build, without any errors, can break such things. I also checked some similar or equal errors with TypeORM in other OSS projects, and most of them were related to how TypeORM and entities are implemented and called.
@Weiko @Jérémy I would appreciate it if you could look at the problem I described above for a few minutes. It looks like it's something trivial, but even though I made all possible tries, I could not find the right place. All seem to work correctly (making builds for BE or FE and running them, working PG db and its initial design setting, seeding with sample data, ...). But when the client tries to log in, the error "code": "INTERNAL_SERVER_ERROR", "response": "No metadata for \"User\" was found."
appears. It looks like it's related to the TypeORM library, but I can't imagine how it could be possible that my build script could be a reason for such a problem. It is simply an equivalent of the original Docker script. Thank you very much for your help.@Miloš Lapiš sorry for the slow answer @Weiko will have a look tomorrow
in the mean time could you use the latest version 0.23.2 (I'm actually publishing the 0.23.3, maybe it's better to wait half an hour to get it)
It might fix your issue, we have heavily touched our ORM layer in the last weeks
@charles Thanks a lot for any help. It sounds like something that could have the potential to break things. 🥲 I will wait and try. And, of course, I will post the actual result. We will see ...
In the meantime, by installing both of them, I eliminated the potential effect of missing PG extensions wrappers and mysql_fdw. However, they don't affect the problem.
PS: The wrappers extension on Ubuntu 22.04 also has a problem because the latest wrappers v0.4.1 is still using the old OpenSSL (libssl.so.1.1), which is not included on Ubuntu 22.04 and it creates also a potential security problem. ❗
@charles I tried to use Twenty v0.23.3 but the problem remains. Any login ends with the error message:
I guess adding some
console.log
in appropriate places would help to confirm if the expected in/out function parameters seem to be what is expected. This would probably be on a separate branch I would use as a repo source.Let's schedule a call today @Miloš Lapiš, what timezone are you on?
@charles We are from Brno in the Czech Republic. Actually I am out of my office, and I'll be back about 4 PM (Central European Time).
Let's join voice channel at 4pm then! Ping me here if I'm not in
@charles I am a bit late. I will ping you at 5 PM.
@charles Can we talk?
sorry!
still available?
@Miloš Lapiš
Yes, we can talk right now.
@Miloš Lapiš could you try to do the exact same commands locally that you are using to setup your server and see if you face the issue too? If yes it will help troubleshooting a lot
@charles Yep, it sounds logical, and it was also my next plan. 😄 I'll do it for sure.
let me know! I thought about your case and I could not find any new idea. I have one more thing I want to test tomorrow but I'm really not sure about it. First time in a year I see this, very intrigued by this bug
@charles Actually I've tried to use the latest version 0.24.0. But the problem remains.
@Miloš Lapiš are you available?
Let's fix it together on a call
Have you tried to run the commands locally btw?
@charles I am here, just focusing on another project now. I need to switch regularly to cover all that is necessary. Time is limited, and we need to live with it. What about tomorrow? Do you know what time would be good for you?
Haha, OK, what time would work for you?
What about 3 PM?
3PM on Paris timezone?
Yes, we have the same timezone ... CET. I am looking forward ...
Ok 🙂
See you tomorrow, hope we will have a brillant idea
@charles Hi, can we talk?
This is good news, and many thanks to @charles for his personal approach to solving the problem of getting Twenty CRM up and running on the PaaS cloud platform https://zerops.io. As usual, the devil is in the details. In our case, the Twenty server was starting from a bad working directory, which affected some relations to the TypeORM library, specifically to the
user.entity.js
file. Everything else was fine.Zerops
Zerops — developer first cloud platform
Zerops is a cloud platform that builds, deploys, runs and manages your apps, no matter the size or environment.
Glad we solved it, it was a tricky one!