Skip to content

db-sync fails to sync SSHPublicKeys #11265

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

Closed
geropl opened this issue Jul 11, 2022 · 6 comments · Fixed by #11286
Closed

db-sync fails to sync SSHPublicKeys #11265

geropl opened this issue Jul 11, 2022 · 6 comments · Fixed by #11286
Assignees
Labels

Comments

@geropl
Copy link
Member

geropl commented Jul 11, 2022

(internal discussion)

For unknown reasons db-sync refuses to insert public SSH keys. We have to find the offending query (e.g. by using staging) and understand what MySQL does not like about it.)

@geropl geropl added type: bug Something isn't working component: db labels Jul 11, 2022
@geropl geropl moved this to Scheduled in 🍎 WebApp Team Jul 11, 2022
@loujaybee
Copy link
Member

Thanks, Gero. I previously observed that I needed to restart workspace after uploading an SSH key for the connection to establish, I was guessing at the time that it could be a DB sync issue. Might be related.

@geropl
Copy link
Member Author

geropl commented Jul 11, 2022

I previously observed that I needed to restart workspace after uploading an SSH key for the connection to establish, I was guessing at the time that it could be a DB sync issue.

That sounds unrelated. Here the effect would be: If I connect to US cluster and store a secret, I cannot use it in the EU cluster.

@akosyakov
Copy link
Member

@mustard-mh I don't see

@Index("ind_dbsync", ["created"]) // DBSync
on DBUserSshPublicKey

@geropl Is it not necessary anymore?

@geropl
Copy link
Member Author

geropl commented Jul 11, 2022

@geropl Is it not necessary anymore?

It's not technical necessary, but good practice to try to keep TS and SQL in sync.

@akosyakov
Copy link
Member

@geropl @mustard-mh Can we verify somehow that all necessary db sync indexes are in place in production database?

@akosyakov akosyakov moved this to Scheduled in 🚀 IDE Team Jul 11, 2022
@andrew-farries andrew-farries self-assigned this Jul 11, 2022
@geropl geropl moved this from Scheduled to In Progress in 🍎 WebApp Team Jul 11, 2022
@andrew-farries
Copy link
Contributor

andrew-farries commented Jul 11, 2022

The error lies in the sql generated here:

if(!forceInsert) {
result.push(`UPDATE ${this.table.name} SET ${updates} WHERE ${updateConditions};`);
}

Where we are not properly escaping the column names, which causes an error for the key column as it's a SQL keyword.

Repository owner moved this from In Progress to Done in 🍎 WebApp Team Jul 11, 2022
@mustard-mh mustard-mh moved this from Scheduled to Done in 🚀 IDE Team Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants