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

Bucket name contains invalid characters #189

Closed
Es-Esa opened this issue Apr 14, 2023 · 16 comments
Closed

Bucket name contains invalid characters #189

Es-Esa opened this issue Apr 14, 2023 · 16 comments

Comments

@Es-Esa
Copy link

Es-Esa commented Apr 14, 2023

Im trying to test my sqlite as live and get "Bucket name contains invalid characters"
What does this mean?

CREATE TABLE toimipisteet (
id INTEGER PRIMARY KEY,
nimi VARCHAR(255) NOT NULL,
osoite VARCHAR(255) NOT NULL,
puhelin VARCHAR(50)
);

CREATE TABLE palvelut (
id INTEGER PRIMARY KEY,
nimi VARCHAR(255) NOT NULL,
kuvaus TEXT,
hinta DECIMAL(10,2) NOT NULL,
toimipiste_id INTEGER,
FOREIGN KEY (toimipiste_id) REFERENCES toimipisteet(id)
);

CREATE TABLE vuokratilat (
id INTEGER PRIMARY KEY,
nimi VARCHAR(255) NOT NULL,
kuvaus TEXT,
hinta DECIMAL(10,2) NOT NULL,
toimipiste_id INTEGER,
FOREIGN KEY (toimipiste_id) REFERENCES toimipisteet(id)
);

CREATE TABLE asiakkaat (
id INTEGER PRIMARY KEY,
nimi VARCHAR(255) NOT NULL,
osoite VARCHAR(255) NOT NULL,
puhelin VARCHAR(50),
email VARCHAR(255)
);

CREATE TABLE varaukset (
id INTEGER PRIMARY KEY,
toimipiste_id INTEGER,
asiakas_id INTEGER,
tila_id INTEGER,
alku_pvm DATE NOT NULL,
loppu_pvm DATE NOT NULL,
FOREIGN KEY (toimipiste_id) REFERENCES toimipisteet(id),
FOREIGN KEY (asiakas_id) REFERENCES asiakkaat(id),
FOREIGN KEY (tila_id) REFERENCES vuokratilat(id)
);

CREATE TABLE laskut (
id INTEGER PRIMARY KEY AUTOINCREMENT,
varaus_id INTEGER,
erapvm DATE NOT NULL,
summa DECIMAL(10,2) NOT NULL,
laskutustapa VARCHAR(10) NOT NULL,
FOREIGN KEY (varaus_id) REFERENCES varaukset(id)
);

CREATE TABLE kayttajat (
id INTEGER PRIMARY KEY,
kayttajatunnus VARCHAR(255),
salasana_hash VARCHAR(255),
isadmin BOOLEAN,
luotu DATETIME
);

CREATE TABLE varaukset_palvelut (
varaus_id INTEGER,
palvelu_id INTEGER,
PRIMARY KEY (varaus_id, palvelu_id),
FOREIGN KEY (varaus_id) REFERENCES varaukset(id),
FOREIGN KEY (palvelu_id) REFERENCES palvelut(id)
);

@chrisjlocke
Copy link
Member

How did you create the database? How did you upload it?
I created a database using your SQL with no issues.
https://dbhub.io/chrisjlocke/db3.db

Can you give a screenshot of the error?

@Es-Esa
Copy link
Author

Es-Esa commented Apr 14, 2023

I createid with dbBrowser
kuva

@chrisjlocke
Copy link
Member

Is the filename you created in DB Browser for SQLite containing unicode characters? Can you try using a more 'simple' name?
I'm not sure what that error refers to, so purely a guess.

@Es-Esa
Copy link
Author

Es-Esa commented Apr 14, 2023 via email

@justinclift
Copy link
Member

Oh wow. That specific error is coming from the storage layer of our backend, and I've not seen it occur before.

What's the name of the database you're trying to use?

As a workaround for now, try using a database name that's made of just plain alphanumeric characters. That should work, while we look into why it's not liking your existing file name.

@justinclift justinclift self-assigned this Apr 14, 2023
@chrisjlocke
Copy link
Member

Try to use your db.

image

Did you click the green download button? Its just called db3.db .. downloaded fine here...

@chrisjlocke
Copy link
Member

Stupid question #2, what is your username in dbhub.io ? Does that have unicode characters?

@justinclift
Copy link
Member

Oh, that might be it too.

That being said, we used to not allow unicode characters in usernames (eg plain alphanumeric was about it), and there's been an outstanding task (for ages) to re-visit that.

I didn't think that had been done yet though.

@justinclift
Copy link
Member

As a Standard database, it seems to be ok (as expected):

https://dbhub.io/Es-Esa/db3.db

@chrisjlocke I'll take a look at this over the weekend, as it sounds like we might need to figure out a different approach for generating the object name to store in Minio.

Instead of basing it upon the database name directly, we could use a hash or randomly generated string instead and store that string in the PostgreSQL database backend.

@chrisjlocke
Copy link
Member

I can download from that link OK...
At what point in the chain (if I can download the file OK) is @Es-Esa getting the error? Its not caching it somewhere else is it?

@justinclift
Copy link
Member

justinclift commented Apr 14, 2023

Nah. That error message occurs at pretty much the final step of the upload process, where the file is transferred to Minio for storage.

For "standard" databases, as they're static snapshots we just calculate the sha256 checksum of the file and use that for the object name. We can't do that with live databases though, so I just went with the simple "use the database name" for the object.

It sounds like the list of characters that Minio accepts is even narrow than what we do. So, I think we'd better switch to using a generated object name for storing it in Minio. That should completely avoid this problem.

It's pretty late here though (11pm), so I'll work on this tomorrow. Hopefully @Es-Esa is ok just using "standard alphanumeric" characters in the database name in the meantime. 😄

@justinclift
Copy link
Member

As a data point, I have an initial working fix for the problem. Going to get some sleep and review it tomorrow before pushing it to the live system though.

@justinclift
Copy link
Member

The fix for this is now live on the production website.

@Es-Esa Any interest in trying again, to verify it's working from your point of view? 😄

@justinclift
Copy link
Member

Closing this, as @Es-Esa doesn't seem to be around. 😮‍💨

@Es-Esa
Copy link
Author

Es-Esa commented Apr 21, 2023

Hei, im testing it right now, seems to work perfectly! thanks and sorry for not been around- I was out town xD

@justinclift
Copy link
Member

Ahhh, no worries at all. If you come across any other weirdness, please let us know. We're fairly active developing this. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants