[Bug][Onboarding] GitHub token on v1.0.3-beta9
Search before asking
- [x] I had searched in the issues and found no similar issues.
What happened
Running into an issue when onboarding a new connection after setup of devlake.
Error 1292 (22007): Incorrect datetime value: '0000-00-00' for column 'token_expires_at' at row 1 (500) Wraps: (2) Error 1292 (22007): Incorrect datetime value: '0000-00-00' for column 'token_expires_at' at row 1 Error types: (1) *hintdetail.withDetail (2) *mysql.MySQLError
Before onboarding it made me run migration changes in the UI.
What do you expect to happen
Ability to create a GitHub connection with a PAT without errors.
How to reproduce
Setup devlake using v1.0.3-beta9. Try to create a GitHub connection
Anything else
No response
Version
v1.0.3-beta9
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Hi @zachspar! I'm Dosu and I’m helping the incubator-devlake team.
This error happens because the database migration adds a token_expires_at column, but the Go struct used for onboarding doesn't include or set this field. As a result, when a new GitHub connection is created, MySQL tries to insert its zero value ('0000-00-00') for a NOT NULL DATETIME column, which is invalid in strict SQL modes and causes the error you see. This is a known class of issue and has affected other datetime fields in previous versions as well (example).
A fix for token management and the token_expires_at field was merged recently (PR #8667), so this should be resolved in a future release. For v1.0.3-beta9, you can work around this by either altering the _tool_github_connections table to allow NULL for token_expires_at, or by manually setting a valid default value (like CURRENT_TIMESTAMP) for that column in your database schema. There is no official workaround documented for this version, but these steps are based on the migration and model analysis.
If possible, keep an eye out for the next release and consider upgrading when it's available.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
Hi @ysinghc, could you please take a look at this when you have a moment? Thanks in advance!
@klesh sure, I will take a look at this issue asap.
I have reproduced the issue. I will try to fix it by the weekend
As a workaround I added below line in command of mysql in docker-compose.yaml:
mysql:
command:
--sql-mode=ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION