Skip to content

Commit b84b8df

Browse files
committed
Update more docs and fix bug of not defined environment
1 parent 977d8e0 commit b84b8df

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Readme.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Serverless Framework plugin to deploy to the Twilio Runtime
1818
- Create a new `package.json`: `npm init`
1919
- Install Twilio Runtime plugin: `npm install save @twilio-labs/serverless-twilio-runtime`
2020
- Create a runtime function at `./functions/hello-world.js`
21-
- Define your function: `exports.handler = function() { callback(null, "hello world!"); };`
21+
- Define your function: `exports.handler = function(context, event, callback) { callback(null, "hello world!"); };`
2222
- Create a `serverless.yml` and define minimal configuration
2323

2424
#### Minimal `serverless.yml` configuration
@@ -34,6 +34,11 @@ provider:
3434
accountSid: ${env:TWILIO_ACCOUNT_SID}
3535
authToken: ${env:TWILIO_AUTH_TOKEN}
3636

37+
# Twilio runtime supports several domains
38+
# your functions and assets will be available under
39+
# -> defaulting to 'dev'
40+
environment: ${env:TWILIO_RUNTIME_ENV, 'dev'}
41+
3742
# Twilio runtime has to be added as a plugin
3843
plugins:
3944
- '@twilio-labs/serverless-twilio-runtime'

info/twilio-info.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ class TwilioInfo {
2929
env => env.domain_suffix === serverless.service.provider.environment
3030
);
3131

32-
// console.log(currentService, currentEnvironment);
33-
3432
const info = await twilioServerlessClient.list({
3533
serviceName: serverless.service.service,
3634
environment: currentEnvironment.sid,

util/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function getTwilioClient(serverless) {
3838
*/
3939
async function getTwilioDeployConfig(serverless, options = {}) {
4040
const config = {
41-
env: serverless.service.provider.environmentVars,
41+
env: serverless.service.provider.environmentVars || {},
4242
pkgJson: {
4343
dependencies: serverless.service.provider.dependencies
4444
},

0 commit comments

Comments
 (0)