Unable to Import Course through Canvas API on a self-hosted environment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023
04:55 AM
Hello,
Canvas newbie here
I am running a Canvas self-hosted environment in addition to a Partner sandbox environment. I followed the steps detailed in Production Start at https://github.com/instructure/canvas-lms/wiki/Production-Start
I am trying to import some Courses into the self-hosted environment the Content Migration API as detailed here. Create a content migration
Steps that I followed are
Create a course with
POST https://{{target}}/api/v1/accounts/{{AccountID}}/courses?enroll_me=true
with the following Request Body
{
"course":
{
"name": "American History",
"course_code": "US History",
"sis_course_id": "kml-amhist-000"
}
}
Next Create a new Content Migration
POST https://{{target}}/api/v1/courses/{{CourseID}}/content_migrations
with the following Request Body
{
"migration_type": "common_cartridge_importer",
"pre_attachment": {
"name": "early-american-history-export.imscc",
"size": 24876353
},
"settings": {
"file_url": "https://s3.amazonaws.com/SSL_Assets/sales/demo_courses/2017/introduction-to-psychology-export.imscc"
}
"selective_import": false
}
This returns among other things upload_url and upload_params
Next I do a multipart upload passing in all the upload_params in the form-data
POST {{UploadURL}}
This returns successfuly but the migration itself fails
{
"id": 33,
"context_id": 15,
"context_type": "ContentMigration",
"user_id": 1,
"tag": "content_migration",
"completion": 0.5,
"workflow_state": "failed",
"created_at": "2023-04-14T10:14:21Z",
"updated_at": "2023-04-14T10:19:17Z",
"message": null,
}
When I query the migration_issues the only suspicious thing I see is this
[
{
"id": 28,
"description": "Error identifying package type: No such file or directory @ rb_sysopen - /var/canvas/tmp/files/0000/0114/early-american-history-export.imscc",
"workflow_state": "active",
"fix_issue_html_url": null,
"issue_type": "warning",
"created_at": "2023-04-14T10:19:17Z",
"updated_at": "2023-04-14T10:19:17Z",
"error_message": null
}
]
I tried with both the local file store as well as Amazon S3 as the file store.
I also verified read/write permissions on the local tmp/files directory and the S3 bucket
I should also note that when I use the Canvas UI to import the Course Content, it works without issues. I compared the request headers and responses in the apache logs when using the UI and the API and they look identical.
BTW when I try the same APIs on my Instructure sandbox, this works flawlessly.
I am wondering if anyone else has successfully set up their own Canvas environment and are able to use Canvas LMS APIs to migrate/import courses?
The open LMS by Instructure, Inc. Contribute to instructure/canvas-lms development by creating an account on GitHub.