Code Monkey home page Code Monkey logo

plugin-rtc's Introduction

@twilio-labs/plugin-rtc

npm CircleCI

This plugin adds functionality to the Twilio CLI which supports developing and deploying real-time communication apps.

Getting Started

Install the Twilio CLI

Via npm or yarn:

$ npm install -g twilio-cli
$ yarn global add twilio-cli

Via homebrew:

$ brew tap twilio/brew && brew install twilio

See the Twilio CLI documentation for more information.

Install the plugin for general use

The following step will install the plugin from NPM and is recommended if you are interested in trying out the commands in the latest release.

$ twilio plugins:install @twilio-labs/plugin-rtc

Install the plugin for local development

The following step will install the plugin from a local directory. Use this option if you are interested in modifying the plugin and testing it out from the Twilio CLI.

$ twilio plugins:link /path/to/plugin-rtc

Supported Apps

This plugin currently supports the following applications:

Twilio Video App

A mobile and web collaboration application built with Twilio Programmable Video. Visit the projects below for instructions on how to use this plugin to build and deploy the Twilio Video app.

Token Server API Documentation

The following section documents the application token server used to provide Programable Video access tokens to supported Twilio Video applications. The token server is deployed as a Twilio Function.

Method URL
POST /token

Authentication

The application token server requires an authentication mechanism to be specified when deploying. The following section documents each supported authentication mechanism.

Passcode

Each request is verified using a passcode generated at deploy time. Passcodes remain valid for one week. After the passcode expires, users can redeploy an application and a new passcode will be generated. The snippet below provides an example request body used by a supported application.

{
  "passcode": "12345612341234",
  "user_identity": "User",
  "room_name": "Demo",
}

Token

This endpoint returns a Programmable Video Access token. When create_room is true, it will create a room, and when create_conversation is true, it will create a Twilio Conversation associated with the room. This token is used by the above mentioned Video Apps to connect to a video room and a conversation.

POST /token

Parameters

Name Type Description
passcode string Required. The application passcode.
user_identity string Required. The user's identity.
room_name string Required when create_room is true A room name that will be used to create a token scoped to connecting to only one room.
create_room boolean (default: true) When false, a room will not be created when a token is requested.
create_conversation boolean (default: false) When true, a Twilio Conversation will be created (if it doesn't already exist) and a participant will be added to it when a token is requested. create_room must also be true.

Success Responses

Status Response
200
{
  "token": "0000000000000000.0000000000000000000000.00000000000000000",
  "room_type": "group" | "group-small" | "peer-to-peer"
}

Error Responses

Status Response
400
{
  "error": {
    "message": "missing user_identity",
    "explanation": "The user_identity parameter is missing."
  }
}
401
{
  "error": {
    "message": "passcode expired",
    "explanation": "The passcode used to validate application users has expired. Re-deploy the application to refresh the passcode."
  }
}
401
{
  "error": {
    "message": "passcode incorrect",
    "explanation": "The passcode used to validate application users is incorrect."
  }
}
400
{
  "error": {
    "message": "invalid parameter",
    "explanation": "A boolean value must be provided for the create_room parameter"
  }
}

Recording Rules

Changes the Recording Rules for a given room SID.

POST /recordingrules

Parameters

Name Type Description
passcode string Required. The application passcode.
room_sid string Required. The SID of the room to change the recording rules of.
rules array Required. An array of recording rules to apply to the room.

Success Responses

Status Response
200
{
  "roomSid": "RM00000000000000000000000000000000",
  "rules": [
    {
      "all": true,
      "type": "exclude"
    }
  ],
  "dateCreated": "2020-11-18T02:58:20.000Z",
  "dateUpdated": "2020-11-18T03:21:18.000Z"
}

Error Responses

Status Response
400
{
  "error": {
    "message": "missing room_sid",
    "explanation": "The room_sid parameter is missing."
  }
}
400
{
  "error": {
    "message": "missing rules",
    "explanation": "The rules parameter is missing."
  }
}
401
{
  "error": {
    "message": "passcode incorrect",
    "explanation": "The passcode used to validate application users is incorrect."
  }
}

Commands

twilio rtc:apps:video:delete

Delete a Programmable Video app

USAGE
  $ twilio rtc:apps:video:delete

OPTIONS
  -l=(debug|info|warn|error|none)  [default: info] Level of logging messages.
  -p, --profile=profile            Shorthand identifier for your profile.

EXAMPLE
  $ twilio rtc:apps:video:delete
  Successfully deleted app.

twilio rtc:apps:video:deploy --authentication <auth>

Deploy a Programmable Video app

USAGE
  $ twilio rtc:apps:video:deploy --authentication <auth>

OPTIONS
  -l=(debug|info|warn|error|none)               [default: info] Level of logging messages.
  -p, --profile=profile                         Shorthand identifier for your profile.
  --app-directory=app-directory                 Name of app directory to use
  --authentication=(passcode)                   (required) Type of authentication to use
  --override                                    Override an existing App deployment
  --room-type=(group|group-small|peer-to-peer|go)  [default: group] Set room type
  --[no-]ui-editable                               Specifies whether the app's files and variables can be edited in the Twilio console.

DESCRIPTION
  This command publishes two components as a Twilio Function: an application token
  server and an optional React application.

  Token Server
  The token server provides Programmable Video access tokens and authorizes
  requests with the specified authentication mechanism.

  React Application
  The commands includes support for publishing a Programmable Video React
  Application. For more details using this plugin with the Programmable Video
  React application, please visit the project's home page.
  https://github.com/twilio/twilio-video-app-react

EXAMPLES
  # Deploy an application token server with passcode authentication
  $ twilio rtc:apps:video:deploy --authentication passcode
  deploying app... done
  Passcode: xxx xxx xxxx xxxx
  Expires: Mon Mar 09 2020 16:36:23 GMT-0600
  Room Type: group
  Edit your token server at: https://www.twilio.com/console/functions/editor/...

  # Deploy an application token server with the React app
  $ twilio rtc:apps:video:deploy --authentication passcode --app-directory /path/to/app
  deploying app... done
  Web App URL: https://video-app-xxxx-xxxx-dev.twil.io?passcode=xxxxxxxxxxxxxx
  Passcode: xxx xxx xxxx xxxx
  Expires: Mon Mar 09 2020 16:36:23 GMT-0600
  Room Type: group
  Edit your token server at: https://www.twilio.com/console/functions/editor/...

  # Override an existing app with a fresh deployment
  # Please note that this will remove a previously deployed web application if no
  # app directory is provided
  $ twilio rtc:apps:video:deploy --authentication passcode --override
  Removed app with Passcode: xxx xxx xxxx xxxx
  deploying app... done
  Passcode: yyy yyy yyyy yyyy
  Expires: Mon Mar 09 2020 16:36:23 GMT-0600
  Room Type: group
  Edit your token server at: https://www.twilio.com/console/functions/editor/...

  # Deploy an application token server with a specific room type
  $ twilio rtc:apps:video:deploy --authentication passcode --room-type peer-to-peer
  deploying app... done
  Passcode: xxx xxx xxxx xxxx
  Expires: Mon Mar 09 2020 16:36:23 GMT-0600
  Room Type: peer-to-peer
  Edit your token server at: https://www.twilio.com/console/functions/editor/...

twilio rtc:apps:video:view

View a Programmable Video app

USAGE
  $ twilio rtc:apps:video:view

OPTIONS
  -l=(debug|info|warn|error|none)  [default: info] Level of logging messages.
  -p, --profile=profile            Shorthand identifier for your profile.

EXAMPLE
  $ twilio rtc:apps:video:view
  Web App URL: https://video-app-1111-dev.twil.io?passcode=xxxxxxxxxxxxxx
  Passcode: xxx xxx xxxx xxxx
  Room Type: group
  Edit your token server at: https://www.twilio.com/console/functions/editor/...

plugin-rtc's People

Contributors

dependabot[bot] avatar olipyskoty avatar snyk-bot avatar timmydoza 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

plugin-rtc's Issues

ReferenceError: Twilio is not defined

/node_modules/@twilio-labs/plugin-rtc/src/serverless/functions/token.js:4
const AccessToken = Twilio.jwt.AccessToken;
^
ReferenceError: Twilio is not defined

The above is what I'm getting for the following lines:
import * as Twilio from 'twilio';
import * as TwilioToken from '@twilio-labs/plugin-rtc/src/serverless/functions/token';

dotenv.config();
const tokenFunction: ServerlessFunction = TwilioToken.handler;
so how can I fix this?
Thanks

Override flag not working as intended

Carter (@crtr0) found a bug in the way the --override flag works. I had a look at the source code and I think I found the issue.

Current behavior

When you pass --override it will actually delete the existing service and generate a new one. The problem with this is that it will create a new URL because the number in the URL pattern: <name>-<number>-<environment>.twil.io is being changed.

if (this.flags.override) {
await this.twilioClient.serverless.services(appInfo.sid).remove();
console.log(`Removed app with Passcode: ${appInfo.passcode}`);

Expected behavior

The URL stays the same and only the code is being updated.

The fix

I checked and you are using @twilio-labs/serverless-api to perform the deployment.

plugin-rtc/src/helpers.js

Lines 125 to 148 in 9544d2b

const deployOptions = {
env: {
TWILIO_ACCOUNT_SID: this.twilioClient.accountSid,
TWILIO_API_KEY_SID: this.twilioClient.username,
TWILIO_API_KEY_SECRET: this.twilioClient.password,
API_PASSCODE: pin,
API_PASSCODE_EXPIRY: expiryTime,
},
pkgJson: {},
serviceName: APP_NAME,
functionsEnv: 'dev',
functions: [
{
name: 'token',
path: '/token',
content: fn,
access: 'public',
},
],
assets: assets,
};
try {
await serverlessClient.deployProject(deployOptions);

Instead of passing in the serviceName for the redeployment you should pass in serviceSid as shown here:
https://github.com/twilio-labs/serverless-api/blob/ee1c171113f9bd3368cbdd82b0f2cf4fee5c8f1c/src/client.ts#L382-L392

This will cause a redeployment to the same service and remove the need for deleting the service. It will also keep the same URL.

Error code ELIFECYCLE (errno 2) for `npm run deploy:twilio-cli`

Steps to Reproduce

git clone https://github.com/twilio/twilio-video-app-react
cd twilio-video-app-react
npm install
npm install twilio-cli -g
# Account SID and Auth Token from: https://www.twilio.com/console/
twilio login
twilio plugins:install @twilio-labs/plugin-rtc
npm run deploy:twilio-cli

^ Bug occurs on deploy last step with note:

» twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: "https://github.com/twilio-labs/plugin-rtc"

Error Output

npm run deploy:twilio-cli -l debug

> [email protected] deploy:twilio-cli /Users/leepowers/work/takeda/video-app/twilio-video-app-react
> cross-env REACT_APP_SET_AUTH=passcode npm run build && twilio rtc:apps:video:deploy --authentication=passcode --app-directory ./build "debug"


> [email protected] build /Users/leepowers/work/takeda/video-app/twilio-video-app-react
> node ./scripts/build.js

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  271.8 KB  build/static/js/2.4d5918e3.chunk.js
  15.15 KB  build/static/js/main.431b0198.chunk.js
  787 B     build/static/js/runtime-main.d9f235a9.js

 ›   Error: EEXIT: 1
 ›   Code: EEXIT
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy:twilio-cli: `cross-env REACT_APP_SET_AUTH=passcode npm run build && twilio rtc:apps:video:deploy --authentication=passcode --app-directory ./build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] deploy:twilio-cli 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:

Debug Log File

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/Cellar/node/14.10.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'deploy:twilio-cli'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [
4 verbose run-script   'predeploy:twilio-cli',
4 verbose run-script   'deploy:twilio-cli',
4 verbose run-script   'postdeploy:twilio-cli'
4 verbose run-script ]
5 info lifecycle [email protected]~predeploy:twilio-cli: [email protected]
6 info lifecycle [email protected]~deploy:twilio-cli: [email protected]
7 verbose lifecycle [email protected]~deploy:twilio-cli: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~deploy:twilio-cli: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/leepowers/work/takeda/video-app/twilio-video-app-react/node_modules/.bin:/Applications/dart-sass:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle [email protected]~deploy:twilio-cli: CWD: /Users/leepowers/work/takeda/video-app/twilio-video-app-react
10 silly lifecycle [email protected]~deploy:twilio-cli: Args: [
10 silly lifecycle   '-c',
10 silly lifecycle   'cross-env REACT_APP_SET_AUTH=passcode npm run build && twilio rtc:apps:video:deploy --authentication=passcode --app-directory ./build'
10 silly lifecycle ]
11 silly lifecycle [email protected]~deploy:twilio-cli: Returned: code: 1  signal: null
12 info lifecycle [email protected]~deploy:twilio-cli: Failed to exec deploy:twilio-cli script
13 verbose stack Error: [email protected] deploy:twilio-cli: `cross-env REACT_APP_SET_AUTH=passcode npm run build && twilio rtc:apps:video:deploy --authentication=passcode --app-directory ./build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1047:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/leepowers/work/takeda/video-app/twilio-video-app-react
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/Cellar/node/14.10.0/bin/node" "/usr/local/bin/npm" "run" "deploy:twilio-cli"
18 verbose node v14.10.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] deploy:twilio-cli: `cross-env REACT_APP_SET_AUTH=passcode npm run build && twilio rtc:apps:video:deploy --authentication=passcode --app-directory ./build`
22 error Exit status 1
23 error Failed at the [email protected] deploy:twilio-cli script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Running out JavaScript heap memory when trying to install rtc plugin

I am running into a problem with memory when trying to install the rtc plugin. I have increased the JavaScript memory allocation to 12GB and have still ran into the same problem shown in the picture. I was wondering if there are any work arounds to this problem and how much memory is needed to install the plugin. Thanks for your time.
twilio_rtc_error

Deploy the app to Twilio fails

Hi Guys,

Am trying to install on my local Dev which is macOS 10.13. This command fails:
$ npm run deploy:twilio-cli
Details below...
Kind Regards
Trent

Issue Summary
The deploy step from the 'how to...' is not working. I had some problems with some file permissions with the 'node_modules' directory but have been able to fix that. Now I've gotten to the end step and it still throws the same error:

» twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: https://github.com/twilio/twilio-cli/issues
How do I add the "-l debug" flag to the npm command? It throws an error as well.

Steps to Reproduce
Install Twilio CLI
Install the RTC plugin
$ npm run deploy:twilio-cli
Exception/Log

paste exception/log here

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'deploy:twilio-cli'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [
4 verbose run-script 'predeploy:twilio-cli',
4 verbose run-script 'deploy:twilio-cli',
4 verbose run-script 'postdeploy:twilio-cli'
4 verbose run-script ]
5 info lifecycle [email protected]predeploy:twilio-cli: [email protected]
6 info lifecycle [email protected]
deploy:twilio-cli: [email protected]
7 verbose lifecycle [email protected]deploy:twilio-cli: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
deploy:twilio-cli: PATH: /usr/local/lib/node_modu$
9 verbose lifecycle [email protected]deploy:twilio-cli: CWD: /Users/trentadamson/Sites$
10 silly lifecycle [email protected]
deploy:twilio-cli: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'cross-env REACT_APP_SET_AUTH=passcode npm run build && twilio rtc:apps:video$
10 silly lifecycle ]
11 silly lifecycle [email protected]deploy:twilio-cli: Returned: code: 1 signal: null
12 info lifecycle [email protected]
deploy:twilio-cli: Failed to exec deploy:twilio-cli$
13 verbose stack Error: [email protected] deploy:twilio-cli: cross-env REACT_APP_SET_A$ 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm$ 13 verbose stack at EventEmitter.emit (events.js:310:20) 13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm$ 13 verbose stack at ChildProcess.emit (events.js:310:20) 13 verbose stack at maybeClose (internal/child_process.js:1021:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) 14 verbose pkgid [email protected] 15 verbose cwd /Users/trentadamson/Sites/twilio-video-app-react 16 verbose Darwin 17.7.0 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy:twilio-cli" 18 verbose node v12.16.2 19 verbose npm v6.14.4 20 error code ELIFECYCLE 21 error errno 1 22 error [email protected] deploy:twilio-cli: cross-env REACT_APP_SET_AUTH=passcode np$
22 error Exit status 1
23 error Failed at the [email protected] deploy:twilio-cli script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Technical details:

  • twilio-cli version:
  • node version:
  • Command output with debug logging enabled (adding -l debug to the end of the command):

Error when deploying

» twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: "https://github.com/twilio-labs/plugin-rtc"
[DEBUG] object null is not iterable (cannot read property Symbol(Symbol.iterator))
[DEBUG] TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
at getPasscode (/Users/jlloretmontalvo/.twilio-cli/node_modules/@twilio-labs/plugin-rtc/src/helpers.js:16:35)
at DeployCommand.getAppInfo (/Users/jlloretmontalvo/.twilio-cli/node_modules/@twilio-labs/plugin-rtc/src/helpers.js:108:24)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async DeployCommand.run (/Users/jlloretmontalvo/.twilio-cli/node_modules/@twilio-labs/plugin-rtc/src/commands/rtc/apps/video/deploy.js:18:20)
at async DeployCommand._run (/Users/jlloretmontalvo/.twilio-cli/node_modules/@twilio-labs/plugin-rtc/node_modules/@twilio/cli-core/node_modules/@oclif/command/lib/command.js:43:20)
at async Config.runCommand (/Users/jlloretmontalvo/.nvm/versions/node/v12.20.0/lib/node_modules/twilio-cli/node_modules/@oclif/config/lib/config.js:173:24)
at async Main.run (/Users/jlloretmontalvo/.nvm/versions/node/v12.20.0/lib/node_modules/twilio-cli/node_modules/@oclif/command/lib/main.js:27:9)
at async Main._run (/Users/jlloretmontalvo/.nvm/versions/node/v12.20.0/lib/node_modules/twilio-cli/node_modules/@oclif/command/lib/command.js:43:20)

Getting error while generating passcode

[DEBUG] Config File: C:\Users\Nilay.twilio-cli\config.json
[DEBUG] Using profile: nilTest
[DEBUG] -- BEGIN Twilio API Request --
[DEBUG] GET https://serverless.twilio.com/v1/Services
[DEBUG] Custom HTTP Headers:
[DEBUG] User-Agent: @twilio/cli-core/5.13.0 (twilio-node/3.53.0, node.js v14.15.1, win32 10.0.19041 x64, rtc:apps:video:deploy)
[DEBUG] -- END Twilio API Request --
[DEBUG] response.statusCode: 200
[DEBUG] response.headers: {"date":"Mon, 07 Dec 2020 11:06:05 GMT","content-type":"application/json; charset=utf-8; charset=utf-8","content-length":"1067","connection":"close","twilio-concurrent-requests":"1","twilio-request-id":"RQf8f9bb1253094b7a95af2462772442e8","twilio-request-duration":"0.024","access-control-allow-origin":"","access-control-allow-headers":"Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since","access-control-allow-methods":"GET, POST, DELETE, OPTIONS","access-control-expose-headers":"ETag","access-control-allow-credentials":"true","x-powered-by":"AT-5000","x-shenanigans":"none","x-home-region":"us1","x-api-domain":"serverless.twilio.com","strict-transport-security":"max-age=31536000"}
[DEBUG] -- BEGIN Twilio API Request --
[DEBUG] GET https://serverless.twilio.com/v1/Services/ZS98611d9174366825df226b9a3916e14e/Environments
[DEBUG] Custom HTTP Headers:
[DEBUG] User-Agent: @twilio/cli-core/5.13.0 (twilio-node/3.53.0, node.js v14.15.1, win32 10.0.19041 x64, rtc:apps:video:deploy)
[DEBUG] -- END Twilio API Request --
[DEBUG] response.statusCode: 200
[DEBUG] response.headers: {"date":"Mon, 07 Dec 2020 11:06:06 GMT","content-type":"application/json; charset=utf-8; charset=utf-8","content-length":"380","connection":"close","twilio-concurrent-requests":"1","twilio-request-id":"RQ80af8255e73343dd85d0b6e8abf82971","twilio-request-duration":"0.016","access-control-allow-origin":"
","access-control-allow-headers":"Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since","access-control-allow-methods":"GET, POST, DELETE, OPTIONS","access-control-expose-headers":"ETag","access-control-allow-credentials":"true","x-powered-by":"AT-5000","x-shenanigans":"none","x-home-region":"us1","x-api-domain":"serverless.twilio.com","strict-transport-security":"max-age=31536000"}
[DEBUG] Found command "rtc:apps:video:deploy" plugin: @twilio-labs/plugin-rtc
» twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: "https://github.com/twilio-labs/plugin-rtc"
[DEBUG] Cannot read property 'sid' of undefined
[DEBUG] TypeError: Cannot read property 'sid' of undefined
at DeployCommand.getAppInfo (C:\Users\Nilay.twilio-cli\node_modules@twilio-labs\plugin-rtc\src\helpers.js:78:64)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async DeployCommand.run (C:\Users\Nilay.twilio-cli\node_modules@twilio-labs\plugin-rtc\src\commands\rtc\apps\video\deploy.js:18:20)
at async DeployCommand._run (C:\Users\Nilay.twilio-cli\node_modules@oclif\command\lib\command.js:43:20)
at async Config.runCommand (C:\Users\Nilay\AppData\Roaming\npm\node_modules\twilio-cli\node_modules@oclif\config\lib\config.js:173:24)
at async Main.run (C:\Users\Nilay\AppData\Roaming\npm\node_modules\twilio-cli\node_modules@oclif\command\lib\main.js:27:9)
at async Main._run (C:\Users\Nilay\AppData\Roaming\npm\node_modules\twilio-cli\node_modules@oclif\command\lib\command.js:43:20)
» Error: EEXIT: 1
» Code: EEXIT

Cannot read properties of undefined (reading 'sid')

[DEBUG] Cannot read properties of undefined (reading 'sid')
[DEBUG] TypeError: Cannot read properties of undefined (reading 'sid')
at DeployCommand.getAppInfo (/Users/mac/.twilio-cli/node_modules/@twilio-labs/plugin-rtc/src/helpers.js:93:64)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async DeployCommand.run (/Users/mac/.twilio-cli/node_modules/@twilio-labs/plugin-rtc/src/commands/rtc/apps/video/deploy.js:18:20)
at async DeployCommand._run (/Users/mac/.twilio-cli/node_modules/@oclif/command/lib/command.js:43:20)
at async Config.runCommand (/usr/local/lib/node_modules/twilio-cli/node_modules/@oclif/core/lib/config/config.js:272:25)
at async Object.run (/usr/local/lib/node_modules/twilio-cli/node_modules/@oclif/core/lib/main.js:74:5)

Unnecessary to set account sid / secret in function environment?

plugin-rtc/src/helpers.js

Lines 127 to 129 in e4e4f93

TWILIO_ACCOUNT_SID: this.twilioClient.accountSid,
TWILIO_API_KEY_SID: this.twilioClient.username,
TWILIO_API_KEY_SECRET: this.twilioClient.password,

I believe it is unnecessary to copy account sid and secret to the function. Functions already have the account sid and secret of the account that owns them. They are available as context.ACCOUNT_SID and context.AUTH_TOKEN

How to deploy without changing passcode

If I don't want to change the passcode when deploying, how can I do that?
For example, can I set the passcode to my specified numbers?

I'm assuming this is not possible as of now.

I'm thinking about making changes in a fork so if there's any advice I'd appreciate it.

How to enable CORS headers

I'm trying to use Twilio video on my JAMstack site hosted on Netlify.

Is there a way for me to enable cross-origin headers on the /token endpoint, so I can access it externally?

Error when generating passcode

Issue Summary

I am attempting to generate a passcode as described here: https://github.com/twilio/twilio-video-app-android#deploy-twilio-access-token-server

Steps to Reproduce

  1. Run twilio rtc:apps:video:deploy --authentication passcode -l debug

Exception/Log

nicolas.dahlquist@mp-nicolasd-ml ~/w/twilio-video-app-react> twilio rtc:apps:video:deploy --authentication passcode -l debug
[DEBUG] Config File: /Users/nicolas.dahlquist/.twilio-cli/config.json
[DEBUG] Using profile: testaccount
[DEBUG] -- BEGIN Twilio API Request --
[DEBUG] GET https://serverless.twilio.com/v1/Services
[DEBUG] User-Agent: @twilio/cli-core/4.5.0 (twilio-node/3.41.1, node.js v13.11.0, darwin 18.7.0 x64, rtc:apps:video:deploy)
[DEBUG] -- END Twilio API Request --
[DEBUG] response.statusCode: 200
[DEBUG] response.headers: {"date":"Thu, 19 Mar 2020 04:41:33 GMT","content-type":"application/json; charset=utf-8; charset=utf-8","content-length":"1067","connection":"close","twilio-concurrent-requests":"1","twilio-request-id":"RQef3f3b82ff6d4f649c2934dca6d2d093","twilio-request-duration":"0.020","access-control-allow-origin":"*","access-control-allow-headers":"Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since","access-control-allow-methods":"GET, POST, DELETE, OPTIONS","access-control-expose-headers":"ETag","access-control-allow-credentials":"true","x-powered-by":"AT-5000","x-shenanigans":"none","x-home-region":"us1","x-api-domain":"serverless.twilio.com","strict-transport-security":"max-age=31536000"}
[DEBUG] -- BEGIN Twilio API Request --
[DEBUG] GET https://serverless.twilio.com/v1/Services/ZSd53e3a289ad47670c6ac2159386227ff/Environments
[DEBUG] User-Agent: @twilio/cli-core/4.5.0 (twilio-node/3.41.1, node.js v13.11.0, darwin 18.7.0 x64, rtc:apps:video:deploy)
[DEBUG] -- END Twilio API Request --
[DEBUG] response.statusCode: 200
[DEBUG] response.headers: {"date":"Thu, 19 Mar 2020 04:41:33 GMT","content-type":"application/json; charset=utf-8; charset=utf-8","content-length":"380","connection":"close","twilio-concurrent-requests":"1","twilio-request-id":"RQaba4f24e6cdc48c18fe38f89f33e7470","twilio-request-duration":"0.025","access-control-allow-origin":"*","access-control-allow-headers":"Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since","access-control-allow-methods":"GET, POST, DELETE, OPTIONS","access-control-expose-headers":"ETag","access-control-allow-credentials":"true","x-powered-by":"AT-5000","x-shenanigans":"none","x-home-region":"us1","x-api-domain":"serverless.twilio.com","strict-transport-security":"max-age=31536000"}
 » twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: https://github.com/twilio/twilio-cli/issues
[DEBUG] Cannot read property 'sid' of undefined
[DEBUG] TypeError: Cannot read property 'sid' of undefined
    at DeployCommand.getAppInfo (/Users/nicolas.dahlquist/.twilio-cli/node_modules/@twilio-labs/plugin-rtc/src/helpers.js:74:64)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async DeployCommand.run (/Users/nicolas.dahlquist/.twilio-cli/node_modules/@twilio-labs/plugin-rtc/src/commands/rtc/apps/video/deploy.js:18:21)
    at async DeployCommand._run (/Users/nicolas.dahlquist/.twilio-cli/node_modules/@oclif/command/lib/command.js:44:20)
    at async Config.runCommand (/usr/local/Cellar/twilio/1.11.0/libexec/node_modules/@oclif/config/lib/config.js:160:9)
    at async Main.run (/usr/local/Cellar/twilio/1.11.0/libexec/node_modules/@oclif/command/lib/main.js:21:9)
    at async Main._run (/usr/local/Cellar/twilio/1.11.0/libexec/node_modules/@oclif/command/lib/command.js:44:20)

Technical details:

  • twilio-cli version: twilio-cli/1.11.0
  • node version: node-v13.11.0
  • plugin-rtc: v0.1.2
  • darwin-x64

This issue was originally reported at twilio/twilio-cli#160.

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.