Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column 'avatarUrl' cannot be null #4066

Closed
ranzbak opened this issue Apr 26, 2021 · 11 comments · Fixed by #4544
Closed

Column 'avatarUrl' cannot be null #4066

ranzbak opened this issue Apr 26, 2021 · 11 comments · Fixed by #4544
Assignees
Labels
aspect: authentication This is a broad, abstract, and almost impractical category that we have yet to sort out. self-hosted type: bug Something isn't working

Comments

@ranzbak
Copy link

ranzbak commented Apr 26, 2021

Bug description

When some users connect, they need to accept the terms of service, and after that the interface stalls.
After +- 30 seconds the error "Sorry, something went wrong 😓 Error 504" appears.
For other users the tos accept works fine.

I'm runnig a self-hosted installation:

  • Rancher 2.5
  • RKE v1.19.9
  • Kubernetes network layer Flannel
  • Gitpod 0.8.0
  • Gitlab 13.10.3-ee
  • Deployment Helm and Helmfile

gitpod-values.zip

Steps to reproduce

I log in to Gitlab as admin, impersonate on of the users that has the problem, and try to open a Gitpod session.

Expected behavior

When accepting the terms of service, Gitpod continues to the workspace.

Example repository

Sorry, something went wrong 😓
Error 504
Please file an issue if you think this is a bug.

Anything else?

I have searched through the logs of Gitpod, but I can't find a reason why it should not work for some persons.
All users that authenticate on Gitlab, do so via Active directory credentials.

@ranzbak
Copy link
Author

ranzbak commented Apr 26, 2021

Hi,

I found the problem, it seems that accounts without an avatar set in Gitlab, cannot use Gitpod.

This error is in the server log:
QueryFailedError: ER_BAD_NULL_ERROR: Column 'avatarUrl' cannot be null

Adding an avatar to the user his account fixes the problem.

I'm not sure what I should do to allow users without an avatar image to access Gitpod.
A more specific error than '504' might have saved time finding the error, is improved error handling in the planning?

@ranzbak ranzbak closed this as completed Apr 26, 2021
@ranzbak
Copy link
Author

ranzbak commented Apr 26, 2021

Here the whole error:

"error": "QueryFailedError: ER_BAD_NULL_ERROR: Column 'avatarUrl' cannot be null\n    at new QueryFailedError (/app/node_modules/typeorm/error/QueryFailedError.js:27:28)\n    at Query.<anonymous> (/app/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js:207:45)\n    at Query.<anonymous> (/app/node_modules/mysql/lib/Connection.js:502:10)\n    at Query._callback (/app/node_modules/mysql/lib/Connection.js:468:16)\n    at Query.Sequence.end (/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)\n    at Query.ErrorPacket (/app/node_modules/mysql/lib/protocol/sequences/Query.js:90:8)\n    at Protocol._parsePacket (/app/node_modules/mysql/lib/protocol/Protocol.js:278:23)\n    at Parser.write (/app/node_modules/mysql/lib/protocol/Parser.js:76:12)\n    at Protocol.write (/app/node_modules/mysql/lib/protocol/Protocol.js:38:16)\n    at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:91:28)\n    at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:502:10)\n    at Socket.emit (events.js:315:20)\n    at Socket.EventEmitter.emit (domain.js:483:12)\n    at addChunk (_stream_readable.js:295:12)\n    at readableAddChunk (_stream_readable.js:271:9)\n    at Socket.Readable.push (_stream_readable.js:212:10)\n    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)",

@AlexTugarev AlexTugarev reopened this Apr 28, 2021
@AlexTugarev AlexTugarev added aspect: authentication This is a broad, abstract, and almost impractical category that we have yet to sort out. self-hosted type: bug Something isn't working labels Apr 28, 2021
@AlexTugarev AlexTugarev changed the title Get a 504 error when accepting terms of service Column 'avatarUrl' cannot be null Apr 28, 2021
@AlexTugarev
Copy link
Member

Hi @ranzbak! Thanks for reporting!
It's strange that the self-hosted GitLab doesn't return any avatar URL, as it usually does even if a user didn't upload an image file.
Anyway this sounds like it can be fixed in Gitpod as well.

@AlexTugarev AlexTugarev self-assigned this Apr 28, 2021
@AlexTugarev AlexTugarev modified the milestones: May 2021 (backlog), [do-not-add-issues] May 2021 Apr 28, 2021
@ranzbak
Copy link
Author

ranzbak commented May 5, 2021

Thanks, let me know when the fix has been merged, so I can roll out the fix.
It's less than ideal to instruct people to set an avatar, if they want to use Gitpod.

@JanKoehnlein
Copy link
Contributor

@AlexTugarev are you still on this or should we take over?

@AlexTugarev AlexTugarev removed their assignment Jun 1, 2021
@AlexTugarev
Copy link
Member

@JanKoehnlein 🙏🏻 please go ahead and thanks 💯

@corneliusludmann
Copy link
Contributor

Unfortunately, I'm not able to reproduce this. Our self-hosted GitLab instance seems to set an avatar for each new user.

However, I think this change (7be8e08) would make sense in general and would also help to solve this particular problem:

diff --git a/components/gitpod-db/src/typeorm/transformer.ts b/components/gitpod-db/src/typeorm/transformer.ts
index 68a74d3c..7aa22ae9 100644
--- a/components/gitpod-db/src/typeorm/transformer.ts
+++ b/components/gitpod-db/src/typeorm/transformer.ts
@@ -11,7 +11,7 @@ import { EncryptionService } from "@gitpod/gitpod-protocol/lib/encryption/encryp
 export namespace Transformer {
     export const MAP_EMPTY_STR_TO_UNDEFINED: ValueTransformer = {
         to(value: any): any {
-            if (value === undefined) {
+            if (value === undefined || value === null) {
                 return '';
             }
             return value;

Alternatively, we could check here for null:

const { id, username, avatar_url, name, email } = result;

@AlexTugarev What do you think?

@ranzbak
Copy link
Author

ranzbak commented Jun 17, 2021

Looks like the patch that should solve this :-)

@AlexTugarev
Copy link
Member

@corneliusludmann, any idea why avatar_url is not present? I have not found a way to disable that.

It's too bad, that the typings are not in sync with the API service.

@corneliusludmann
Copy link
Contributor

@corneliusludmann, any idea why avatar_url is not present? I have not found a way to disable that.

No, was not able to reproduce. Tried gitlab.com and our self-hosted GitLab.

@corneliusludmann
Copy link
Contributor

corneliusludmann commented Jun 18, 2021

@ranzbak The issue is solved in the main branch and will be deployed by the end of the month. Thanks for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aspect: authentication This is a broad, abstract, and almost impractical category that we have yet to sort out. self-hosted type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants