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

TypeError: can't access property "id", bucket.data is undefined #2371

Closed
grahamalama opened this issue Mar 16, 2022 · 3 comments
Closed

TypeError: can't access property "id", bucket.data is undefined #2371

grahamalama opened this issue Mar 16, 2022 · 3 comments
Labels
bug stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.

Comments

@grahamalama
Copy link
Contributor

grahamalama commented Mar 16, 2022

Steps to reproduce:

  • navigate to https://kinto.github.io/kinto-admin/ (or use local build to point at demo server)
  • Log in with anonymous auth
  • There should be one bucket visible f8ba1b65-d87b-f57a-8e22-0f731d957e68 with a collection test. Click on the test collection (or navigate directly to /#/buckets/f8ba1b65-d87b-f57a-8e22-0f731d957e68/collections/test/records)

Expected: Something is rendered to the screen (either records, or some error message if no records are present)
Actual: White screen. When using Devtools on the local build of kinto-admin, the following error messages appear:

Uncaught TypeError: can't access property "id", bucket.data is undefined
...
The above error occurred in the <ListActions> component:
...
@leplatrem
Copy link
Contributor

The bucket is not readable anonymously:

http https://demo.kinto-storage.org/v1/buckets/f8ba1b65-d87b-f57a-8e22-0f731d957e68
HTTP/1.1 401 Unauthorized
....
{
    "code": 401,
    "errno": 104,
    "error": "Unauthorized",
    "message": "Please authenticate yourself to use this endpoint."
}

But the collection is:

http https://demo.kinto-storage.org/v1/buckets/f8ba1b65-d87b-f57a-8e22-0f731d957e68/collections/test
HTTP/1.1 200 OK
....
{
    "data": {
        "attachment": {
            "enabled": false,
            "required": false
        },
        "cache_expires": 0,
        "displayFields": [
            "title"
        ],
        "id": "test",
        "last_modified": 1634629772258,
        "schema": {
            "properties": {
        ....

The bucket object in the state is thus empty, and I suspect this code to assume it isn't. In that case the bucket id can be taken from the match prop instead (which is populated from URL hash)

@alexcottner alexcottner added the stale For marking issues as stale. Labeled issues will be closed soon if label is not removed. label Jul 22, 2024
@alexcottner
Copy link
Contributor

Possibly corrected in #3178

@alexcottner
Copy link
Contributor

This appears to be corrected now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.
Projects
None yet
Development

No branches or pull requests

3 participants