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
API misbehavior with SQLite #96
Comments
Thanks for the report! Yes, this query should use the That's also a good point about pagination on the |
Setting the It seems that SQLite doesn't like queries with byte arrays and returns an empty result set. If you replace the access token with a textual representation in the database ( One solution is to store the token in text if when in SQLite mode but this sounds like technical debt to me (code branches both in writes and reads). I suppose that the tokens were stored in blobs for performance reasons so converting to text for both db backends is probably not a good idea? I can create a PR with the minor |
This solves the error 500 on the /api/me endpoint but the issue is not completely solved as this now throws a 401, similar to the other endpoints, due to SQLite returning an empty result set when queried with byte array. See the issue discussion for more info.
Thanks for taking a look at this, @qwazix! I would say we should avoid changing what data we store and just try to fix the issue with SQLite. Looking at the schema again, we're using |
…ll need to check if MySQL still works after the change.
…o checked with MySQL and it still works after the change.
I checked with Please have a look at the PR. |
I've done some testing with these changes and it seems that it does work when using |
Describe the bug
In database.go, many SQL calls are made that include
NOW()
, howeverNOW()
does not exist in SQLite3 (see here and here for documentation and examples respectively). As such, endpoints like/api/me
return errors wheneveraccess_tokens
are used.Edit: I did not notice before that the
now()
function existed, however, from what I can tell, it is not used in this line, which is causing the issue.Steps to reproduce (if necessary)
/api/auth/login
)/api/me
)500
error from server (My guess is it is triggered at this line)Expected behavior
Should have received user data
Application configuration
Version or last commit: V0.9.1
Other notes
/api/me/posts
and/api/me/collections
endpoints return401
errors, but/api/me
returns500
./api/me/posts
and similar should probably support pagination or similar to prevent undue strain on the server / excessive bandwidth usage from users with a large volume of posts.The text was updated successfully, but these errors were encountered: