“Entity::userName(): Return value must be of type string, null returned”

Before migrating this project, I migrated another one and everything worked correctly, but in this one, when I log in I get the following error: “Entity::userName(): Return value must be of type string, null returned”

And I do not know what the problem is, can someone help me?

What I did was, I deleted all the folder I had, and let the v2025 create everything, and that’s when the error came up.

Now I had to do the same thing again, delete the whole folder but let the v2024 version generate everything, and with that I fixed the problem, but it is not the solution I am looking for.

Make sure the user name field setting in the project is correct (exist and letter case is correct) and the user name is not null in the database.

Yeah everything its correct, my DB didn’t change, If i downgrade to v2024 work perfectly

There was no userName() method in Entity class of v2024, so there was no similar error. The error message means there is no user name field in your project.

If you are a registered user of v2025, you better send your project file and other required info to support.

My question is, Why the error said thar there is no user name fields in my project? There is a user name fields on my project

Just Curious if you got an answer to this one @DGarza
i have the same issue on logins to an app (new version of 2025.3)
may need to submit a ticket otherwise.
Thanks

Hi,

Regarding this issue, we’ve found that we get this error only if the users table used for security, and the users field have the same name.

For example, if I have a table “dbo.User”, and the field “User”, the we have the error.

Also, if the table name ends with an “s”, the file on “src/entity/” seems to strip this last “s”. For example, if the table name is “dbo.Users” and the field is “User”, this will also have the error.

Best regards.

1 Like

You may post complete stack trace for discussion. Eable Debug, generate scripts again, run until you see the error, then copy the stack trace from the log. Also post the source of the error line.

If you are a registered user of v2025, you better send your project file and other required info to support directly.