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

ERR: Cannot query field "part_keys" on type "Cohort" #183

Open
mmphego opened this issue Jan 14, 2021 · 14 comments · May be fixed by #187
Open

ERR: Cannot query field "part_keys" on type "Cohort" #183

mmphego opened this issue Jan 14, 2021 · 14 comments · May be fixed by #187

Comments

@mmphego
Copy link

mmphego commented Jan 14, 2021

Describe the bug
Issue when downloading a beta course.

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Node version: v10.22.1
  • npm version: 6.14.6
  • Udacimak Version: v1.6.6
  • Browser: Brave(Chrome)
@mssrivatsa
Copy link

mssrivatsa commented Jan 15, 2021

I also tried to use download command and encountered the error below with multiple nanodegrees.

2021-01-15T10:39:24.723Z [info]: Start downloading Nanodegree xxxx from Udacity API
✔ Get Nanodegree xxxx information
2021-01-15T10:39:25.027Z [info]: You're authorized to download version 1.0.0, locale en-us of Nanodegree xxxx
✖ Get Nanodegree xxxx information
2021-01-15T10:39:25.115Z [error]: Failed to download course. See error below:
[
{
"message": "Cannot query field "part_keys" on type "Cohort".",
"status": null
},
{
"message": "Cannot query field "part_keys" on type "NDUnit".",
"status": null
}
]

I suspected a change in graphql schema of udacity nanodegree content and did the following to resolve the issue.

FIX

  1. Download the source

  2. Modify src/api/fetchNanodegree to delete part_keys\n from the graphql query in both cohort and ndunit

  3. Build the source locally

  4. Execute the following command from the generated lib directory

          node index.js "download" xxxx
    

xxxx is the nanodegree ID. You can use the installed udacimak for the render step as that works fine.

@udacimak First of all, huge thanks for creating this awesome tool! Please update the src/api/fetchNanodegree to resolve this issue.

@mmphego
Copy link
Author

mmphego commented Jan 15, 2021

@mssrivatsa Thanks for the fix. Could you please make a PR.

@mmphego
Copy link
Author

mmphego commented Jan 15, 2021

Fix as per @mssrivatsa

vim ~/.npm-packages/lib/node_modules/udacimak/lib/api/fetchNanodegree.js 

Replace const queryGraphql with:

  const queryGraphql = `{\"query\":\"\\n    query NanodegreeQuery {\\n      nanodegree(key: \\\"${key}\\\" version: \\\"${version}\\\" locale: \\\"${locale}\\\") {\\n        \\n  id\\n  key\\n  title\\n  semantic_type\\n  is_public\\n\\n                version\\n        locale\\n        title\\n        color_scheme\\n        enrollment {\\n          product_variant\\n          variant\\n          free_preview_status\\n          free_preview_expires_at\\n          static_access {\\n            static_access\\n            access_expiry_at\\n          }\\n        }\\n        \\n        hero_image {\\n          url\\n        }\\n        forum_path\\n        summary\\n        is_graduated\\n        is_term_based\\n        is_default\\n        project_deadlines {\\n          \\n  due_at\\n  node_key\\n\\n        }\\n        \\n  user_state {\\n    node_key\\n    completed_at\\n    last_viewed_at\\n    unstructured\\n  }\\n\\n        \\n  aggregated_state {\\n    node_key\\n    completion_amount\\n    completed_count\\n    concept_count\\n    last_viewed_child_key\\n    part_aggregated_states {\\n      node_key\\n      completed_at\\n      completion_amount\\n      completed_count\\n      concept_count\\n      last_viewed_child_key\\n      module_aggregated_states {\\n        node_key\\n        completed_at\\n        completion_amount\\n        completed_count\\n        concept_count\\n        last_viewed_child_key\\n        lesson_aggregated_states {\\n          node_key\\n          completed_at\\n          completed_count\\n          concept_count\\n          completion_amount\\n          last_viewed_child_key\\n        }\\n      }\\n    }\\n  }\\n\\n        \\n  resources {\\n    files {\\n      name\\n      uri\\n    }\\n    google_plus_link\\n    career_resource_center_link\\n    coaching_appointments_link\\n    office_hours_link\\n    aws_provisioning_link\\n  }\\n\\n        specializations {\\n          key\\n          title\\n          required_count\\n        }\\n        parts(part_types: [FreePreview, Core, Elective, Career]) {\\n          \\n  id\\n  key\\n  title\\n  semantic_type\\n  is_public\\n\\n          version\\n          locale\\n          summary\\n          part_type\\n          is_public\\n          locked_reason\\n          locked_until\\n          content_ready_date_ms\\n          \\n  resources {\\n    files {\\n      name\\n      uri\\n    }\\n    google_plus_link\\n    career_resource_center_link\\n    coaching_appointments_link\\n    office_hours_link\\n    aws_provisioning_link\\n  }\\n\\n          \\n  image {\\n    url\\n    width\\n    height\\n  }\\n\\n          specialization {\\n            key\\n            image {url width height}\\n            video {youtube_id}\\n            duration_in_weeks\\n            overview\\n            partners\\n            resources\\n          }\\n          modules {\\n            \\n  id\\n  key\\n  title\\n  semantic_type\\n  is_public\\n\\n            version\\n            locale\\n            is_project_module\\n            forum_path\\n            lessons {\\n              \\n  id\\n  key\\n  version\\n  locale\\n  semantic_type\\n  summary\\n  title\\n  duration\\n  is_public\\n  is_project_lesson\\n  display_workspace_project_only\\n  lesson_type\\n\\n              \\n  image {\\n    url\\n    width\\n    height\\n  }\\n\\n              \\n  video {\\n    youtube_id\\n    china_cdn_id\\n  }\\n\\n              lab {\\n                \\n  id\\n  key\\n  version\\n  locale\\n  estimated_session_duration\\n  duration\\n  is_public\\n  semantic_type\\n  title\\n  evaluation_objective\\n  partners\\n  overview {\\n    title\\n    summary\\n    key_takeaways\\n    video {\\n      topher_id\\n      youtube_id\\n    }\\n  }\\n  details {\\n    text\\n  }\\n  review_video {\\n    topher_id\\n    youtube_id\\n  }\\n  result {\\n    state\\n    skill_confidence_rating_after\\n    skill_confidence_rating_before\\n  }\\n  workspace {\\n    \\n  id\\n  key\\n  title\\n  semantic_type\\n  is_public\\n\\n    workspace_id\\n    pool_id\\n    view_id\\n    configuration\\n    starter_files\\n  }\\n\\n              }\\n              project {\\n                \\n  key\\n  version\\n  locale\\n  duration\\n  semantic_type\\n  title\\n  description\\n  is_public\\n  summary\\n  forum_path\\n  rubric_id\\n  terminal_project_id\\n  \\n  resources {\\n    files {\\n      name\\n      uri\\n    }\\n    google_plus_link\\n    career_resource_center_link\\n    coaching_appointments_link\\n    office_hours_link\\n    aws_provisioning_link\\n  }\\n\\n  \\n  image {\\n    url\\n    width\\n    height\\n  }\\n\\n\\n              }\\n              concepts {\\n                \\n  id\\n  key\\n  title\\n  semantic_type\\n  is_public\\n\\n                \\n  resources {\\n    files {\\n      name\\n      uri\\n    }\\n    google_plus_link\\n    career_resource_center_link\\n    coaching_appointments_link\\n    office_hours_link\\n    aws_provisioning_link\\n  }\\n\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  \",\"variables\":null,\"locale\":\"en-us\"}`;

And then run udacimak download ***** -t .

@jose0628
Copy link

Would it be possible to add this fix into the docker container image as well? It would be deeply appreciated

@mohitcpatil
Copy link

mohitcpatil commented Feb 1, 2021

I am still facing even after following all the steps. I changed the file locally as per @mssrivatsa said :
vim ~/.npm-packages/lib/node_modules/udacimak/lib/api/fetchNanodegree.js

Next step - udacimak download xxxx

Please advised
Screen Shot 2021-02-01 at 1 57 20 AM

Hussain-Alsalman added a commit to Hussain-Alsalman/udacimak that referenced this issue Feb 1, 2021
@Gurleen-Sadiora
Copy link

When will this be updated in the official npm download? Thanks

@Mohamed-Ashraf-D
Copy link

Mohamed-Ashraf-D commented Feb 9, 2021

i cannot solve this problem on windows could any one help me please

@mmphego mmphego linked a pull request Feb 10, 2021 that will close this issue
9 tasks
@rossheat
Copy link

Please update the NPM download with this fix.

@michael-fawzy
Copy link

I downloaded the source files and made the changes. How can I build the source locally?

@THEKINGSTAR
Copy link

I downloaded the source files and made the changes. How can I build the source locally?

npm install -g udacimak

@michael-fawzy
Copy link

michael-fawzy commented Feb 18, 2021

I downloaded the source files and made the changes. How can I build the source locally?

npm install -g udacimak

I suppose this is just the regular install from npm. I need to install it from the local source code after editing it

@JunshengFu
Copy link

I downloaded the source files and made the changes. How can I build the source locally?

Did you find a way to do it? I have the same question as yours.

@THEKINGSTAR
Copy link

THEKINGSTAR commented Feb 23, 2021 via email

@Tarek-Bohdima
Copy link

a working fix: #230 (comment)

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

Successfully merging a pull request may close this issue.