instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.6k stars 2.48k forks source link

RCE cannot access Course Files #1583

Open sodiumchl opened 4 years ago

sodiumchl commented 4 years ago

Summary:

Try to add/link to media files from Course Files in the new RCE, an error occurs: "Something went wrong. Cannot read property 'length' of undefined.

The log files the following lines:

ActionController::RoutingError (No route matches [GET] "/api/folders"):
ActionController::RoutingError (No route matches [GET] "/api/session"):
app/middleware/request_context_generator.rb:49:in `call'
app/middleware/prevent_non_multipart_parse.rb:33:in `call'

Steps to reproduce:

OS ubuntu 18.04.1 canvas stable/2020-02-12 psql (PostgreSQL) 10.12 ruby 2.4.9p362 (2019-10-02 revision 67824) [x86_64-linux-gnu] Bundler version 1.17.3 gem 2.7.10 node v10.19.0

Installed per "Production Start" document.

Additional Notes:

If "new features" in RCE is disabled, i.e., the old RCE interface is used, the "Files" tab in insert links is greyed out.

Cannot Access Media

sodiumchl commented 4 years ago

I see this from Production Start:

Canvas includes a new rich content editor component to support a consistent editor experience across multiple applications in the Canvas ecosystem. To make use of this component you need to run a supporting API server. See the Canvas RCE API Documentation for information on running the service and configuring Canvas to make use of it.

Got it to work this way:

Added to Apache2 conf:

Listen 3000
<VirtualHost *:3000>
  ServerName my.domain.com
  ServerAlias localhost 

  SSLEngine on
  SSLCertificateKeyFile /etc/ssl/xxxx.key
  SSLCertificateFile /etc/ssl/xxxx.crt
  SSLCertificateChainFile /etc/ssl/xxxx.ca-bundle

  PassengerAppRoot /var/canvas-rce-api
  PassengerAppType node
  PassengerStartupFile app.js
</VirtualHost>

/var/canvas/config/dynamic_settings.yml

production:
  config:
    canvas:
      canvas:
        encryption-secret: "mysecrete-afdasdfsadfdsafsda"
        signing-secret: "mysecrete-afdasdfsadfdsafsda"
      rich-content-service:
        app-host: "my.domain.com:3000"

/var/canvas-rce-api/.env

PORT=3000
NODE_ENV=production
STATSD_HOST=127.0.0.1
STATSD_PORT=8125
STATS_PREFIX=rceapi
ECOSYSTEM_SECRET="mysecrete-afdasdfsadfdsafsda"
ECOSYSTEM_KEY="mysecrete-afdasdfsadfdsafsda"
CIPHER_PASSWORD="Notused"
danielblignaut commented 4 years ago

see this https://github.com/instructure/canvas-rce-api/issues/12