by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:35
    dependabot-preview[bot] opened #211
  • 05:34
    dependabot-preview[bot] opened #156
  • 05:23
    dependabot-preview[bot] opened #234
  • 01:29

    dependabot-preview[bot] on npm_and_yarn

    (compare)

  • 01:29

    dependabot-preview[bot] on master

    Bump codemirror from 5.58.0 to … (compare)

  • 01:29
    dependabot-preview[bot] closed #1502
  • 01:26

    dependabot-preview[bot] on npm_and_yarn

    (compare)

  • 01:26

    dependabot-preview[bot] on master

    Bump eslint-plugin-react from 7… (compare)

  • 01:26
    dependabot-preview[bot] closed #1501
  • 01:15
    dependabot-preview[bot] labeled #1502
  • 01:15
    dependabot-preview[bot] opened #1502
  • 01:15

    dependabot-preview[bot] on npm_and_yarn

    Bump codemirror from 5.58.0 to … (compare)

  • 01:14
    dependabot-preview[bot] labeled #1501
  • 01:14
    dependabot-preview[bot] opened #1501
  • 01:14

    dependabot-preview[bot] on npm_and_yarn

    Bump eslint-plugin-react from 7… (compare)

  • 01:04
    dependabot-preview[bot] labeled #2611
  • 01:04
    dependabot-preview[bot] labeled #2611
  • 01:04
    dependabot-preview[bot] opened #2611
  • 01:04

    dependabot-preview[bot] on npm_and_yarn

    Bump codemirror from 5.58.0 to … (compare)

  • 01:02

    dependabot-preview[bot] on pip

    (compare)

linusdm
@linusdm
Never mind. The Timezone setting of postgres was not correct. https://docs.kinto-storage.org/en/latest/configuration/production.html#database-setup
Sergey Maranchuk
@slav0nic
@dstaley is it possible implemented progress bar for attachment uploading based on kinto-http.js?
Sergey Maranchuk
@slav0nic
also let client = new KintoClient(url) and client.events is undefined
Dylan Staley
@dstaley
@slav0nic not at the moment, no. If you file an issue I can take a look! Also yes, that's the expected behavior in the new release. You need to provide your own EventEmitter. You can use the events package, or mitt (which would be my suggestion).
Sergey Maranchuk
@slav0nic
about events i think docs is wrong:
events: The events handler. If none provided an EventEmitter instance will be created
also none term in js looks strange =)
Dylan Staley
@dstaley
@slav0nic good catch! I'll update the docs
Chew Guan Xun
@guanxun14

You need to provide your own EventEmitter.

May I learn how might this work in kinto.js? Trying to sync I get:

TypeError: "e is undefined"
    a https://example.com/static/js/kinto.min.js:25
    pushChanges https://example.com/static/js/kinto.min.js:25
    sync https://example.com/static/js/kinto.min.js:25

Events docs doesn't let me know how to set it up either.

Dylan Staley
@dstaley
Can you try running with the unminified version (or make sure sourcemaps are being loaded) so we can see where the error is coming from? Not providing an EventEmitter shouldn't cause an error.
Chew Guan Xun
@guanxun14

Ok, using kinto.js (14.0),

TypeError: "r is undefined"
    toDelete https://example.com/static/js/kinto.js:4602
    pushChanges https://example.com/static/js/kinto.js:4602
    sync https://example.com/static/js/kinto.js:4761

Line 4602 of kinto.js: const toDelete = changes.filter((r) => r._status === "deleted");

I'm unsure if it has anything to do with this being the first attempted sync on the collection and kinto instance? (tried my luck with collection.resetSyncStatus() but it's no help)

By the way thank you for sharing your expertise! :)

Dylan Staley
@dstaley
No problem! Yeah, that one's super weird. Do you have any remoteTransformers setup?
Chew Guan Xun
@guanxun14

Yes! It looks like this:

var lzStringTransformer = {
    encode(record) {
        if (record.title) { record.title = LZString.compressToUTF16(record.title); }
    }, 
    decode(record) {
        if (record.title) { record.title = LZString.decompressFromUTF16(record.title); }
    }
};
tasksCollection = kintoDB.collection('collection-name', {
    remoteTransformers: [ lzStringTransformer ]
});

Using the lz-string compression library.

Dylan Staley
@dstaley
Ahh okay yeah, your transformers need to return the updated record.
Chew Guan Xun
@guanxun14
OKAY! Just had to return record and it worked
Dylan Staley
@dstaley
:tada:
Chew Guan Xun
@guanxun14
Yup :) Don't know how you knew to look there but THANK YOU! :)
Dylan Staley
@dstaley
Ha, I just walked backwards from the sync method. Essentially it was passing undefined into pushChanges, so I looked to see where it was passing in the data, and saw that it was mapping the remote transformers over the records before passing them to pushChanges. Certainly not something we expect users to do though!
Chew Guan Xun
@guanxun14
Yeah no I could've avoided this all by implementing it properly from the start. It's sorted though so all's good :)
Chew Guan Xun
@guanxun14

Is it possible to add a normal, simple Pyramid view via a custom plugin?

Doing this in my custom plugin's includeme function:

config.add_route('hello', '/hello-world')
config.add_view(hello_world, route_name='hello')
print('Included custom plugin')

Where hello_world is:

from pyramid.response import Response

def hello_world(request):
    return Response('Hello World!')

Just leads to a 404 when I visit https://kintoserver/v1/hello-world.

I think the plugin is being included correctly as it prints Included custom plugin upon running kinto migrate.

I tried to reference the kinto-admin plugin which apparently does the same thing to allow you to visit /v1/admin, and I'm not sure why this isn't working the same way for me.

Dylan Staley
@dstaley
@guanxun14 I believe you need to define it as a service. https://docs.kinto-storage.org/en/stable/tutorials/write-plugin.html#add-a-search-view
Sergey Maranchuk
@slav0nic
i don't think that i possible without tricks, you can disable kinto.version_prefix_redirect_enabled = false but i still got 404 from https://github.com/Kinto/kinto/blob/9acb793a84f9ca72625b2c6cb24bbaccad7c4975/kinto/core/views/errors.py#L52
Chew Guan Xun
@guanxun14

Ok I got it working by implementing the service:

# __init__.py
def includeme(config):
    config.scan('custom_plugin_name.views')
    print('Included custom plugin')

# custom_plugin_name/views.py
from kinto.core import Service

service_endpoint = Service(name='some-name', path='/some-url', description='some description')

@service_endpoint.get()
def get_service_endpoint(request):
    return { 'result': True }

You have to also return a dictionary, which is fine for my use case as I just need to return a 200.

Thank you all for the help! :)

Chew Guan Xun
@guanxun14
I'm sorry — it seems you can return strings/booleans/etc. too. Thought I should state that just in case
Sergey Maranchuk
@slav0nic
@guanxun14 you can check https://cornice.readthedocs.io docs, kinto internally use cornice for rest (Service class)
Chew Guan Xun
@guanxun14
I did figure that out - fortunately. Thanks for the additional guidance! :)
Chew Guan Xun
@guanxun14

Hi again, I'm running into two issues — not sure if they're overlapping in some way:

1) Receiving server flushed error upon deleting last record in collection

Occasionally, the user deletes the last existing record in their collection. This inevitably results in a (unwanted) server flushed error upon the next sync.

How should this be properly handled? Two options I can think of:
a) Add a dummy, invisible record that never shows to the user, but prevents the collection from emptying out.
b) Ignore server flushed errors and go ahead and clear the local collection.
I guess (a) is the better option, but I'm not sure if that's the correct/best way to do it?

Additionally and interestingly, I also get the server flushed error in the following scenario:

  • Add two records locally.
  • Sync both records to remote in one .sync() call (syncStrategy is MANUAL).
  • Delete one of the records remotely (via the admin).
  • Perform .sync() locally (syncStrategy is PULL_ONLY).
  • Get server flushed error 🤷‍♂️🤷‍♂️

2) Deleting records remotely doesn't sync to local

Deleting a record remotely via the admin UI or via another local device doesn't register when I call sync() on the original local device where the record was created.

After the deletion, the local sync result object lists only the remaining existing record in the updated array, and the remotely deleted record is left untouched.

I am using a remoteTransformer for client-side encryption, but I'm not messing with either _status or deleted fields in the transformer.

In conclusion

Apologies for writing a message so long it requires a conclusion. However I would be grateful for where to look / how to approach this / or any insight into what I might be missing here as it seems I'm not handling something about deleting records correctly. Thank you! :)

Chew Guan Xun
@guanxun14
Thanks, but I don't think that's what I'm looking for as the remotely deleted record is meant to be deleted locally as well.
Chew Guan Xun
@guanxun14
@dstaley any ideas?
Sergey Maranchuk
@slav0nic
Dylan Staley
@dstaley
@guanxun14 unfortunately it sounds like you might need to put together a reproducible demo in order for us to track this down. I delete the last record in a collection all the time and don't run into any issues, so there's something funky going on in your setup I think. Have you tried running your app against the public Kinto instance (if that's even possible for your app that is)?
Dylan Staley
@dstaley
Another thing I'd look into is whether your database is retaining deleted records. By default, Kinto keeps a record of all deleted records.
Chew Guan Xun
@guanxun14

Ok, I've isolated its occurrence to a custom collection that I create upon an account registration notification, via a plugin:

account_email_slug = slugify(registered_email)

storage_backend.create(
    resource_name='collection',
    parent_id='/buckets/custombucket',
    obj={'id': account_email_slug}
)
permission_backend.add_principal_to_ace(
    '/buckets/custombucket/collections/'+email_slug,
    'record:create',
    'account:'+registered_email
)

I wanted to do it this way instead of using the default bucket to have finer grain control over the user's permissions on the server side.

Will dig further into it, but I guess if I can't figure it out then I might settle for going with the default bucket, and handling permissions on the client.

Thanks @slav0nic @dstaley for the guidance, felt like I was at my wit's end earlier but now I have some direction. :)

Greg Koval
@gregg00
Hello,
Does anyone have issues that they are working on that they would like some help with? I'm new to kinto/opensource but willing to learn and put time in. Thanks!
Dylan Staley
@dstaley
Hi @gregg00! What programming languages are you looking to contribute in? Kinto has projects in almost every language, and I'd be happy to help point out some places where you can contribute.
h4xhor
@h4xhor

Hi Kinto community. I'm so glad I found this Gitter channel!

In https://www.kinto-storage.org/ are you able to update the footer of the site to remove Slack (which I presume was shutdown) and add Gitter there in it's place (as it took me a while to find this Gitter channel through the docs).

I think I've found a bug on Kinto version 13.6.6 (as version 13.6.5 didn't have this error). I'm not sure where's the best place to post this (here or on GitHub for future reference?)

When I try to access the Kinto web based admin dashboard I get this error at the browser console:

==========

--- Error Start ---

react-dom.production.min.js:209 Error: Invariant failed
at t.a (tiny-invariant.esm.js:9)
at Switch.js:17
at vu (react-dom.production.min.js:268)
at ls (react-dom.production.min.js:246)
at us (react-dom.production.min.js:246)
at Zu (react-dom.production.min.js:239)
at Qu (react-dom.production.min.js:230)
at Is (react-dom.production.min.js:281)
at react-dom.production.min.js:284
at ts (react-dom.production.min.js:240)
eu @ react-dom.production.min.js:209
react-dom.production.min.js:256 Uncaught Error: Invariant failed
at t.a (tiny-invariant.esm.js:9)
at Switch.js:17
at vu (react-dom.production.min.js:268)
at ls (react-dom.production.min.js:246)
at us (react-dom.production.min.js:246)
at Zu (react-dom.production.min.js:239)
at Qu (react-dom.production.min.js:230)
at Is (react-dom.production.min.js:281)
at react-dom.production.min.js:284

at ts (react-dom.production.min.js:240)

==========

--- Error End ---

I confirmed the bug on these two platforms:

Platform 1

  • Kinto version 13.6.6
  • In a Python virtual environment with Python version 3.8.5
  • pip 20.1.1
  • Operating System: Arch Linux

Platform 2

  • Kinto version 13.6.6
  • In a Python virtual environment with Python version 3.8.2
  • pip 20.1.1
  • Operating System: Ubuntu 20.04 LTS

It was previously working before on Kinto version 13.6.5 and I can confirm that after downgrading from Kinto version 13.6.6 to version 13.6.5 the web admin works again. I used this pip command to downgrade:
(venv) $ pip install "kinto<=13.6.5" --force-reinstall

Many thanks in advance!

Dylan Staley
@dstaley
@h4xhor thank you for the report! I must have missed the footer when updating things. Could you file an issue in the kinto-admin repo and tag me? I can take a look tomorrow. It looks to be an issue with the admin, but it could also be an issue with kinto. Once I dig into it I can confirm.
Chew Guan Xun
@guanxun14

may I ask what exactly does the expectedTimestamp option of the sync method in kinto.js do? The description is unfortunately a little unclear:

A timestamp to use as a "cache busting" query parameter.

Looking at the source, it looks like it passes the timestamp as a filter to server call for listing records, but I'm not sure it about beyond that.

If it helps, i'm trying to handle the case of syncing a local change that was made while a sync call was already ongoing, after that first sync completes. Passing an expectedTimestamp value seems to address the issue, but I want to be sure I'm using it correctly.

thank you!

Dylan Staley
@dstaley
Actually I think the description is accurate. It's just a query parameter that ensures the response isn't from the cache
As far as I can tell, Kinto server doesn't process that parameter
Chew Guan Xun
@guanxun14
Hmm ok gotcha, thanks! :)
h4xhor
@h4xhor
Hi @dstaley thanks very much for looking into this. I've submitted the Kinto/kinto-admin#1469.
Philipp Krüger
@matheus23
Hi! We're trying to talk to a local kinto container. Issuing a PUT request to one of the collection's records, the browser runs a CORS preflight OPTIONS request, but Kinto returns a 400 status code. Running any OPTIONS request to the same url from curl results in a 400 status code too. Running a request as GET works, though.

Because the CORS preflight doesn't succeed with 200, firefox blocks our actual request.

Why does Kinto return a 400 on an OPTIONS request?

$ curl --header "Origin: http://localhost:3000/" --header "Access-Control-Request-Method: PUT"  -X OPTIONS "http://localhost:8888/v1/buckets/flatmate/collections/items/records"
{"code":400,"errno":107,"error":"Invalid parameters","message":"Access-Control-Request-Method in header: Method not allowed","details":[{"location":"header","name":"Access-Control-Request-Method","description":"Method not allowed"}]}
$ curl --header "Origin: http://localhost:3000/" --header "Access-Control-Request-Method: GET"  -X OPTIONS "http://localhost:8888/v1/buckets/flatmate/collections/items/records"
null
Philipp Krüger
@matheus23
Nevermind! We solved the issue
the PUT method needs to be run against buckets/flatmate/collections/items/records/12344 with a record id!
h4xhor
@h4xhor
Hi is there any plans to make a Kinto package for Flutter? If not I was thinking maybe I'll attempt to write one with
idb_sqflite - Indexed DB for flutter on top of sqflite
Mathieu Leplatre
@leplatrem
Not that I know of! But it could give a great boost to the project :)