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

Console Permissions - Cannot read property 'length' of undefined #3789

Closed
jcmoore0 opened this issue Jan 28, 2020 · 5 comments
Closed

Console Permissions - Cannot read property 'length' of undefined #3789

jcmoore0 opened this issue Jan 28, 2020 · 5 comments
Labels
c/console Related to console e/quickfix can be wrapped up in few hours k/bug Something isn't working p/urgent Immediate action required

Comments

@jcmoore0
Copy link

jcmoore0 commented Jan 28, 2020

Problem: Error: Cannot read property 'length' of undefined
Additional Info:

  1. Occurs when editing 'SELECT' permission.
  2. Is intermittent and usually occurs on 1 of my 2 roles for a table.
  3. Bulk sql/ loadSchema data from server is missing 'permissions.select.computed_fields' empty array
  4. I don't have any computed_columns

v1.1.0-beta.2

line 89 - console/src/components/Services/Data/PermissionsSummary/utils.js
permission['computed_fields'] is undefined

 Object.keys(tableFields).forEach(fieldType => {
      noFields = noFields && !permission[fieldType].length;

      allFields =
        allFields &&
        (permission[fieldType] === '*' || 
          permission[fieldType].length === tableFields[fieldType].length);   <-- there is not a computed_fields property on permission
    });

Thanks,
John

@rikinsk rikinsk added c/console Related to console e/quickfix can be wrapped up in few hours k/bug Something isn't working p/urgent Immediate action required labels Jan 29, 2020
@jcmoore0
Copy link
Author

Thanks @rikinsk for the quick response.
As a short term work around, I can use the previous console version to edit permissions.

@rikinsk
Copy link
Member

rikinsk commented Jan 31, 2020

@jcmoore0 I was unfortunately not able to reproduce this. I assume you must be seeing a 500 page shown when the error occurs. Could you share the error stack trace displayed.

@rikinsk rikinsk added the support/needs-more-info Needs more details/info/repro instructions label Jan 31, 2020
@jcmoore0
Copy link
Author

jcmoore0 commented Jan 31, 2020

Hi @rikinsk - I am getting all 200 responses. It happens on several tables on one of my 2 roles.

data returns with 200:

  return dispatch(requestAction(url, options)).then(
      data => {
        const mergedData = mergeLoadSchemaData(
          JSON.parse(data[0].result[1]),
          data[1],
          JSON.parse(data[2].result[1]),
          JSON.parse(data[3].result[1])
        );

Missing property computed_fields:[]

data[1][5].permissions[0].permissions.select {
  filter: {attachment: {…}}
  columns: (5) 
  allow_aggregations: false
}

Client error:

TypeError: Cannot read property 'length' of undefined
    at http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:408806:171
    at Array.forEach (<anonymous>)
    at getPermissionColumnAccessSummary (http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:408801:30)
    at getColumnSection (http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:524287:160)
    at getEditSection (http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:525120:246)
    at Permissions.render (http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:525223:103)
    at Permissions.hotComponentRender (http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:233559:67)
    at Permissions.proxiedRender (http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:233579:36)
    at finishClassComponent (http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:225044:31)
    at updateClassComponent (http://127.0.0.1:3001/rstatic/dist/main-885638bc67bbc108f8ba.js:224999:24)

@rikinsk
Copy link
Member

rikinsk commented Jan 31, 2020

Thanks for the extra info. I'll take a look at it again.

@rikinsk rikinsk removed the support/needs-more-info Needs more details/info/repro instructions label Jan 31, 2020
rikinsk added a commit to rikinsk/graphql-engine that referenced this issue Jan 31, 2020
rikinsk added a commit to rikinsk/graphql-engine that referenced this issue Jan 31, 2020
@rikinsk rikinsk mentioned this issue Jan 31, 2020
8 tasks
rikinsk added a commit that referenced this issue Feb 1, 2020
* handle string errors
* handle empty columns / computed fields in permissions (#3789)
* allow is_null for all operators (#3777)
@rikinsk
Copy link
Member

rikinsk commented Feb 1, 2020

closed in fca16b8

@rikinsk rikinsk closed this as completed Feb 1, 2020
polRk pushed a commit to polRk/graphql-engine that referenced this issue Feb 12, 2020
* handle string errors
* handle empty columns / computed fields in permissions (hasura#3789)
* allow is_null for all operators (hasura#3777)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/console Related to console e/quickfix can be wrapped up in few hours k/bug Something isn't working p/urgent Immediate action required
Projects
None yet
Development

No branches or pull requests

2 participants