GithubHelp home page GithubHelp logo

harvard-edtech / caccl Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 4.0 1.29 MB

The Canvas App Complete Connection Library (CACCL) is an all-in-one library for building Canvas-integrated apps. By handling LTI, authorization, and api for you, CACCL makes building Canvas-integrated tools quick and easy. Keywords: Canvas LMS Instructure API LTI Authorization EdTech Education

License: MIT License

JavaScript 3.88% TypeScript 96.12%

caccl's People

Contributors

gabeabrams avatar karendolan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

caccl's Issues

How to set up multiple launch paths?

Hello @gabeabrams,
I added my app to Canvas, but I need multiple launch paths (course, user & admin). How do I do this? I have this in my config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<cartridge_basiclti_link ...>
    <blti:title>CACCL TEST</blti:title>
    ...
    <blti:launch_url>https://ahs-pre-web-ada-next.azurewebsites.net/canvas/launch</blti:launch_url>
    <blti:extensions platform="canvas.instructure.com">
        <lticm:property name="privacy_level">public</lticm:property>
        <lticm:options name="course_navigation">
            <lticm:property name="url">https://xxxxx.azurewebsites.net/course</lticm:property>
            <lticm:property name="text">CACCL TEST</lticm:property>
            <lticm:property name="visibility">public</lticm:property>
            <lticm:property name="default">enabled</lticm:property>
            <lticm:property name="enabled">true</lticm:property>
        </lticm:options>
        <lticm:options name="account_navigation">
            <lticm:property name="url">https://xxxxx.azurewebsites.net/admin</lticm:property>
            <lticm:property name="text">CACCL TEST</lticm:property>
            <lticm:property name="enabled">true</lticm:property>
        </lticm:options>
        <lticm:options name="user_navigation">
            <lticm:property name="url">https://xxxxx.azurewebsites.net/user</lticm:property>
            <lticm:property name="text">CACCL TEST</lticm:property>
            <lticm:property name="enabled">true</lticm:property>
        </lticm:options>
    </blti:extensions>
    ...
</cartridge_basiclti_link>

The course, user and admin routes are correctly set up in my app, but if I click the link in the (sub)account navigation, I get this error:

Cannot POST /admin

I tried several variations of the launch URL (e.g., /canvas/launch/admin), but without success.
In development, I used this config:

{
    ...
    "customLaunchPaths": [
        {
            "name": "Course Launch",
            "path": "/course"
        },
        {
            "name": "User Launch",
            "path": "/user"
        },
        {
            "name": "Admin Launch",
            "path": "/admin"
        }
    ]
}

How do I configure this correctly for a production environment? Could you please point me in the right direction?

Using CACCL on Windows

After some tweaking in package.json I found this is all that's needed to make it work on Windows:

"scripts": {
    "test": "echo 'Error: no test specified' && exit 1",
    "start": "node index.js",
    "postinstall": "cd client && npm install",
    "build": "cd client && npm install && npm run build",
    "dev:canvas": "node ./node_modules/caccl/canvas/startPartialSimulation",
    "dev:server": "cross-env DEV=true npm start",
    "dev:client": "cd client && cross-env DEV=true npm start"
}
  • Use cross-env for setting environment variables
  • use && for chaining commands

Error using init

Whenever I try to initialize a project this is what I get:

npx: installed 172 in 25.046s
internal/validators.js:125
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.join (path.js:427:7)
at Object. (C:\Users\NAME\AppData\Roaming\npm-cache_npx\19764\node_modules\create-caccl\helpers\getPackageJSON.js:8:30)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)

Any tips on how to resolve this issue?

Thanks!

Unable to deploy on server

Even if I create a vanilla CACCL app, when I run npm run build and then npm start I get this:

events.js:170
throw er; // Unhandled 'error' event
^

Error: listen EACCES: permission denied 0.0.0.0:443
at Server.setupListenHandle [as _listen2] (net.js:1241:19)
at listenInCluster (net.js:1306:12)
at Server.listen (net.js:1394:7)
at module.exports (/home/aya16/lti-final/node_modules/caccl/genExpressApp.js:157:12)
at module.exports (/home/aya16/lti-final/node_modules/caccl/validateConfigAndSetDefaults/server.js:449:18)
at module.exports (/home/aya16/lti-final/node_modules/caccl/server/index.js:116:18)
at module.exports (/home/aya16/lti-final/node_modules/caccl/server/react.js:161:15)
at Object. (/home/aya16/lti-final/index.js:10:13)
at Module._compile (internal/modules/cjs/loader.js:805:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
Emitted 'error' event at:
at emitErrorNT (net.js:1285:8)
at processTicksAndRejections (internal/process/task_queues.js:81:17)
at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:56:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:871:11)
at internal/main/run_main_module.js:21:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/aya16/.npm/_logs/2019-04-04T23_10_47_675Z-debug.log

Error on installing with init

On a Mac, node version 11.9.0. When walking through the npm init steps for React + Express, fails out when trying to create the React app:
error [email protected]: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "11.9.0"

Cookie from Production Server Doesn't Get Sent Properly on HTTPS

I have an CACCL 2.0.5-backed LTI app that works fine on the dev server. In installed it on a cloud server on Kubernetes where it runs in pure HTTP mode on port 8080. A load balancer sits in front of it and terminates TLS there.

When Canvas calls the /canvas/launch URI, the browser gets a Set-Cookie for CACCL_Canvas_app and a session cookie, but that cookie is marked HttpOnly. Thus the browser, on subsequent requests, knowing it's going to an HTTPS URL, doesn't send the cookie. Therefore the LTI thinks that someone is trying to run it's being run outside of Canvas and barfs.

I'm looking through the code to see where the cookie sent back, but I haven't found it yet.

Course context

@gabeabrams

How do you grab the context for what course you open the LTI in? In the examples, you are passing in an arbitrary course id:

app.get('/student-names', async (req, res) => {
  if (!req.api) {
    return res.send('Oops! You are not authorized.');
  }
  
  const students = await req.api.course.listStudents({ courseId: 58320 });

  const names = students.map(x => x.name).join(', ');

  return res.send(`Here are all your student's names: ${names}`);
});

Which operating system & node version has this been tested with?

We are having some issues getting this project working, we have tried running it on the latest stable version of Fedora & Debian. Could someone please recommend a tested nodejs & npm version, as well as a distribution setup to test this project?
Thank you!

Integration with express API server app

Hello,
This is more of a 'hopefully you can point me in the right direction' query, but I have an Express API app that I built that I would like to integrate with your CACCL app. The API allows me to authenticate users with JWT and get / post content via MongoDB. I would like to use this in conjunction with CACCL to build a React client that allows Canvas users to create content etc. What would be the best way to integrate with your CACCL app? Thanks again.

App keeps asking for permission after deployment

Hi @gabeabrams,
After successfully deploying my app as an Azure web app, I can launch the app, but it keeps asking for permission to access my account each time I click the navigation button in my Canvas course. This should normally only happen the first time, right?
Am I doing something wrong here?

How to add LTI to Canvas

This is just a question that seems to be missing from the docs, but after getting an app built, what is the launch endpoint and secret / secret combo that one would use for adding it as an app in Canvas? Thanks!

Chrome local dev http vs https sameSite cookie issue

If you are running the local dev for a react app and in the Chrome browser continually get a message like "Session Expired Go to Canvas and reopen this page.". But it works in the Safari & FireFox browser, it might be the Chrome schemeful-same-site parameter that forbids sameSite cookies across protocols such as https and http.

A temporary workaround for Chrome is to go into the chrome settings (chrome://flags/) and change the
#schemeful-same-site Chrome from “default” or "enabled" to “disabled. Then, reload the Chrome browser. Set this back to default or enabled when done testing.

A longer term option may be to set up a local HTTPS cert to be used for your dev testing.

Error while creating new project

Hi, I'm getting this error when running npm init caccl. Everything goes well up until the point when the server needs to be installed:

The syntax of the command is incorrect.
node:child_process:903
    throw err;
    ^

Error: Command failed: mkdir server/src
    at checkExecSyncError (node:child_process:826:11)
    at execSync (node:child_process:900:15)
    at exec (C:\Users\xxxxxxxx\AppData\Local\npm-cache\_npx\6d57d4f7ad4edc8c\node_modules\create-caccl\lib\index.js:49:41)
    at Object.createCACCL [as default] (C:\Users\xxxxxxxx\AppData\Local\npm-cache\_npx\6d57d4f7ad4edc8c\node_modules\create-caccl\lib\index.js:200:5)
    at Object.<anonymous> (C:\Users\xxxxxxxx\AppData\Local\npm-cache\_npx\6d57d4f7ad4edc8c\node_modules\create-caccl\lib\init.js:15:34)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 59416,
  stdout: null,
  stderr: null
}
npm ERR! code 1
npm ERR! path C:\Users\xxxxxxxx\Projects\CACCL-test\caccl-v1-test
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-caccl

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxxxxxxx\AppData\Local\npm-cache\_logs\2023-05-09T17_47_58_659Z-debug.log

I'm on Windows 10, running a bash terminal inside VSCode.

node: v16.13.2
npm: v8.1.2

Please launch this app via Canvas.

@gabeabrams

I am getting a Please launch this app via Canvas. error when trying to launch from within the course. I don't see any logs anywhere to describe the issue. Any troubleshooting ideas?

Trouble setting up project with init

Hi, I'm having trouble setting up a project using npm init caccl.

root@ubuntu-bionic:/vagrant# npm init caccl
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module '/root/.npm/_npx/11188/lib/node_modules/create-caccl/node_modules/ejs/postinstall.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! Maximum call stack size exceeded

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-04-13T20_58_49_384Z-debug.log
Install for [ 'create-caccl@latest' ] failed with code 1

Any help would be really appreciated. Thank you!

I'm using Vagrant to run Ubuntu 18.04 LTS (Bionic Beaver) on a Windows 10 host.
Node vesion: 14.16.1
NPM version: 6.14.12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.