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.
yarn run database:init:prod
yarn run command:prod workspace:seed:dev
yarn run command:prod workspace:sync-metadata -f
yarn run database:init:prod
yarn run command:prod workspace:seed:dev
yarn run command:prod workspace:sync-metadata -f
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
Miloš Lapiš
Miloš LapišOP4mo ago
Payload of the POST request /graphql:
{
"operationName": "CheckUserExists",
"variables": {
"email": "[email protected]"
},
"query": "query CheckUserExists($email: String!, $captchaToken: String) {
checkUserExists(email: $email, captchaToken: $captchaToken) {
exists
__typename
}
}"
}
{
"operationName": "CheckUserExists",
"variables": {
"email": "[email protected]"
},
"query": "query CheckUserExists($email: String!, $captchaToken: String) {
checkUserExists(email: $email, captchaToken: $captchaToken) {
exists
__typename
}
}"
}
Miloš Lapiš
Miloš LapišOP4mo ago
No description
Miloš Lapiš
Miloš LapišOP4mo ago
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?
{
"operationName": "CheckUserExists",
"variables": {
"email": "[email protected]",
"captchaToken": "03AFcWeA7CI2H...JYTCBbP8AO8s-4VPFjrQFcXFSU"
},
"query": "query CheckUserExists($email: String!, $captchaToken: String) {
checkUserExists(email: $email, captchaToken: $captchaToken) {
exists
__typename
}
}"
}
{
"operationName": "CheckUserExists",
"variables": {
"email": "[email protected]",
"captchaToken": "03AFcWeA7CI2H...JYTCBbP8AO8s-4VPFjrQFcXFSU"
},
"query": "query CheckUserExists($email: String!, $captchaToken: String) {
checkUserExists(email: $email, captchaToken: $captchaToken) {
exists
__typename
}
}"
}
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?
{
"data": {
"clientConfig": {
.....,
"captcha": {
"__typename": "Captcha",
"provider": null,
"siteKey": null
},
...
}
{
"data": {
"clientConfig": {
.....,
"captcha": {
"__typename": "Captcha",
"provider": null,
"siteKey": null
},
...
}
ɃØĦɆᵾS
ɃØĦɆᵾS4mo ago
Why would you use captcha if there's no need to use it when self-hosting unless it's self-hosted for company?
Miloš Lapiš
Miloš LapišOP4mo ago
@ɃØĦɆᵾ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.
{
"operationName": "CheckUserExists",
"variables": {
"email": "[email protected]",
"captchaToken": "03AFcWeA6ahftIph....70SKrvj1-Kz3BwuzFgMiO"
},
"query": "query CheckUserExists($email: String!, $captchaToken: String) {
checkUserExists(email: $email, captchaToken: $captchaToken) {
exists
__typename
}
}"
}
{
"operationName": "CheckUserExists",
"variables": {
"email": "[email protected]",
"captchaToken": "03AFcWeA6ahftIph....70SKrvj1-Kz3BwuzFgMiO"
},
"query": "query CheckUserExists($email: String!, $captchaToken: String) {
checkUserExists(email: $email, captchaToken: $captchaToken) {
exists
__typename
}
}"
}
Miloš Lapiš
Miloš LapišOP4mo ago
@ɃØĦɆᵾS This the site URL, if you want to look: https://app-44d-3000.prg1.zerops.app
Twenty
A modern open-source CRM
ɃØĦɆᵾS
ɃØĦɆᵾS4mo ago
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)
Miloš Lapiš
Miloš LapišOP4mo ago
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:
git clone https://github.com/twentyhq/twenty.git
mkdir api
cd twenty
cp ./package.json ./yarn.lock ./.yarnrc.yml ./tsconfig.base.json ./nx.json ../api/
cp -r --parents ./.yarn/releases ../api/
cp --parents ./packages/twenty-emails/package.json ../api/
cp --parents ./packages/twenty-server/package.json ../api/
cp -r --parents ./packages/twenty-server/patches ../api/
cd ..
cd api
yarn && yarn cache clean && npx nx reset
cd ..
cd twenty
cp -r ./packages/twenty-emails/. ../api/packages/twenty-emails
cp -r ./packages/twenty-server/. ../api/packages/twenty-server
cd ..
cd api
npx nx run twenty-server:build
mv ./packages/twenty-server/dist ./packages/twenty-server/build
npx nx run twenty-server:build:packageJson
mv ./packages/twenty-server/dist/package.json ./packages/twenty-server/package.json
rm -rf ./packages/twenty-server/dist
mv ./packages/twenty-server/build ./packages/twenty-server/dist
cd ..
cd api/packages/twenty-server
yarn run database:init:prod
yarn run command:prod workspace:seed:dev
yarn run command:prod workspace:sync-metadata -f
git clone https://github.com/twentyhq/twenty.git
mkdir api
cd twenty
cp ./package.json ./yarn.lock ./.yarnrc.yml ./tsconfig.base.json ./nx.json ../api/
cp -r --parents ./.yarn/releases ../api/
cp --parents ./packages/twenty-emails/package.json ../api/
cp --parents ./packages/twenty-server/package.json ../api/
cp -r --parents ./packages/twenty-server/patches ../api/
cd ..
cd api
yarn && yarn cache clean && npx nx reset
cd ..
cd twenty
cp -r ./packages/twenty-emails/. ../api/packages/twenty-emails
cp -r ./packages/twenty-server/. ../api/packages/twenty-server
cd ..
cd api
npx nx run twenty-server:build
mv ./packages/twenty-server/dist ./packages/twenty-server/build
npx nx run twenty-server:build:packageJson
mv ./packages/twenty-server/dist/package.json ./packages/twenty-server/package.json
rm -rf ./packages/twenty-server/dist
mv ./packages/twenty-server/build ./packages/twenty-server/dist
cd ..
cd api/packages/twenty-server
yarn run database:init:prod
yarn run command:prod workspace:seed:dev
yarn run command:prod workspace:sync-metadata -f
and run:
node api/packages/twenty-server/dist/src/main
node api/packages/twenty-server/dist/src/main
As the deployed code is taken:
./api/package.json
./api/node_modules/
./api/packages/twenty-server/package.json
./api/packages/twenty-server/node_modules/
./api/packages/twenty-server/dist/
./api/packages/twenty-emails/package.json
./api/packages/twenty-emails/dist/
./api/package.json
./api/node_modules/
./api/packages/twenty-server/package.json
./api/packages/twenty-server/node_modules/
./api/packages/twenty-server/dist/
./api/packages/twenty-emails/package.json
./api/packages/twenty-emails/dist/
@ɃØĦɆᵾS And these are the environment variables used to build and run:
ACCESS_TOKEN_SECRET
LOGIN_TOKEN_SECRET
REFRESH_TOKEN_SECRET
FILE_TOKEN_SECRET
PG_DATABASE_URL
SERVER_URL
FRONT_BASE_URL
SIGN_IN_PREFILLED
ACCESS_TOKEN_SECRET
LOGIN_TOKEN_SECRET
REFRESH_TOKEN_SECRET
FILE_TOKEN_SECRET
PG_DATABASE_URL
SERVER_URL
FRONT_BASE_URL
SIGN_IN_PREFILLED
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.
ɃØĦɆᵾS
ɃØĦɆᵾS4mo ago
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 data
Miloš Lapiš
Miloš LapišOP4mo ago
As 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.
"database:reset": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"cwd": "packages/twenty-server",
"commands": [
"nx ts-node-no-deps -- ./scripts/truncate-db.ts",
"nx ts-node-no-deps -- ./scripts/setup-db.ts",
"nx database:migrate",
"nx command-no-deps -- workspace:seed:dev"
],
"parallel": false
}
}
"database:reset": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"cwd": "packages/twenty-server",
"commands": [
"nx ts-node-no-deps -- ./scripts/truncate-db.ts",
"nx ts-node-no-deps -- ./scripts/setup-db.ts",
"nx database:migrate",
"nx command-no-deps -- workspace:seed:dev"
],
"parallel": false
}
}
ɃØĦɆᵾS
ɃØĦɆᵾS4mo ago
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 more
Miloš Lapiš
Miloš LapišOP4mo ago
Thanks 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. 😻
ɃØĦɆᵾS
ɃØĦɆᵾS4mo ago
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"?
Miloš Lapiš
Miloš LapišOP4mo ago
@ɃØĦɆᵾS Yes, I have checked that.
No description
Miloš Lapiš
Miloš LapišOP4mo ago
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.
Brendan
Brendan4mo ago
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 ...
Miloš Lapiš
Miloš LapišOP4mo ago
@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.
charles
charles4mo ago
@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
Miloš Lapiš
Miloš LapišOP4mo ago
@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:
{
"errors": [
{
"message": "No metadata for \"User\" was found.",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"response": "No metadata for \"User\" was found."
}
}
],
"data": null
}
{
"errors": [
{
"message": "No metadata for \"User\" was found.",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"response": "No metadata for \"User\" was found."
}
}
],
"data": null
}
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.
charles
charles4mo ago
Let's schedule a call today @Miloš Lapiš, what timezone are you on?
Miloš Lapiš
Miloš LapišOP4mo ago
@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).
charles
charles4mo ago
Let's join voice channel at 4pm then! Ping me here if I'm not in
Miloš Lapiš
Miloš LapišOP4mo ago
@charles I am a bit late. I will ping you at 5 PM. @charles Can we talk?
charles
charles4mo ago
sorry! still available? @Miloš Lapiš
Miloš Lapiš
Miloš LapišOP4mo ago
Yes, we can talk right now.
charles
charles4mo ago
@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
Miloš Lapiš
Miloš LapišOP4mo ago
@charles Yep, it sounds logical, and it was also my next plan. 😄 I'll do it for sure.
charles
charles4mo ago
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
Miloš Lapiš
Miloš LapišOP4mo ago
@charles Actually I've tried to use the latest version 0.24.0. But the problem remains.
charles
charles3mo ago
@Miloš Lapiš are you available? Let's fix it together on a call Have you tried to run the commands locally btw?
Miloš Lapiš
Miloš LapišOP3mo ago
@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?
charles
charles3mo ago
Haha, OK, what time would work for you?
Miloš Lapiš
Miloš LapišOP3mo ago
What about 3 PM?
charles
charles3mo ago
3PM on Paris timezone?
Miloš Lapiš
Miloš LapišOP3mo ago
Yes, we have the same timezone ... CET. I am looking forward ...
charles
charles3mo ago
Ok 🙂 See you tomorrow, hope we will have a brillant idea
Miloš Lapiš
Miloš LapišOP3mo ago
@charles Hi, can we talk?
Miloš Lapiš
Miloš LapišOP3mo ago
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.
charles
charles3mo ago
Glad we solved it, it was a tricky one!
Want results from more Discord servers?
Add your server