From 200e5bd17a49e64dc7b75e41c25fb91a51175b73 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Mon, 13 Jan 2020 16:11:57 +0800
Subject: [PATCH 01/14] fix auth

---
 package.json                |  2 +-
 provider/tencentProvider.js | 14 ++++++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/package.json b/package.json
index cc6387d..d9a2207 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.22",
+  "version": "0.1.24",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
diff --git a/provider/tencentProvider.js b/provider/tencentProvider.js
index 8c9861f..166ac00 100644
--- a/provider/tencentProvider.js
+++ b/provider/tencentProvider.js
@@ -290,14 +290,12 @@ class TencentProvider {
         }
       })
       // From cam to getting appid
-      if (!this.options.credentials.tencent_appid) {
-        const appid = await this.getAppid({
-          SecretId: this.options.credentials.tencent_secret_id,
-          SecretKey: this.options.credentials.tencent_secret_key
-        })
-        this.options.credentials.tencent_appid = appid.AppId
-        this.options.credentials.tencent_owneruin = appid.OwnerUin
-      }
+      const appid = await this.getAppid({
+        SecretId: this.options.credentials.tencent_secret_id,
+        SecretKey: this.options.credentials.tencent_secret_key
+      })
+      this.options.credentials.tencent_appid = appid.AppId
+      this.options.credentials.tencent_owneruin = appid.OwnerUin
     } catch (e) {}
     return
   }

From 3924b0343dcbda351196eca7556eb8e79399298e Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Mon, 13 Jan 2020 17:29:34 +0800
Subject: [PATCH 02/14] fix auth

---
 package.json                | 2 +-
 provider/tencentProvider.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package.json b/package.json
index d9a2207..4735387 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.24",
+  "version": "0.1.25",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
diff --git a/provider/tencentProvider.js b/provider/tencentProvider.js
index 166ac00..6e605e9 100644
--- a/provider/tencentProvider.js
+++ b/provider/tencentProvider.js
@@ -72,7 +72,7 @@ class TencentProvider {
           "You don't have real name authentication yet. You can open the url or scan QR code for real name authentication."
         )
         console.log('Real name authentication url: ')
-        console.log(verifyUrl)
+        console.log('https://console.cloud.tencent.com/developer/auth')
         console.log('Real name authentication QR code: ')
         QRCode.toString(verifyUrl, { type: 'terminal' }, function(err, url) {
           console.log(url)

From 5d9829307e7382a7d389c7f0d82407e8b6fa69a0 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Thu, 16 Jan 2020 10:33:22 +0800
Subject: [PATCH 03/14] fix creating

---
 deploy/lib/deployFunction.js | 2 +-
 package.json                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/deploy/lib/deployFunction.js b/deploy/lib/deployFunction.js
index 2ab1a9d..57ac525 100644
--- a/deploy/lib/deployFunction.js
+++ b/deploy/lib/deployFunction.js
@@ -24,7 +24,7 @@ class DeployFunction extends AbstractHandler {
       // when update code Status is Active, continue
       let status = 'Updating'
       let times = 90
-      while (status == 'Updating') {
+      while (status == 'Updating' || status == 'Creating') {
         const tempFunc = await this.getFunction(ns, funcObject.FuncName)
         status = tempFunc.Status
         await utils.sleep(1000)
diff --git a/package.json b/package.json
index 4735387..c2a24f5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.25",
+  "version": "0.1.26",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",

From 5520993ca1ebda9a5d78eece199a3d42f78ccb68 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Tue, 28 Jan 2020 09:50:28 +0800
Subject: [PATCH 04/14] fix creating

---
 deploy/tencentDeploy.js              | 6 +++++-
 deploy/tencentDeployFunction.js      | 6 +++++-
 deploy/tencentDeployList.js          | 6 +++++-
 deploy/tencentDeployListFunctions.js | 6 +++++-
 info/tencentInfo.js                  | 6 +++++-
 invoke/tencentInvoke.js              | 6 +++++-
 logs/tencentLogs.js                  | 6 +++++-
 metrics/tencentMetrics.js            | 6 +++++-
 package.json                         | 2 +-
 remove/tencentRemove.js              | 6 +++++-
 rollback/tencentRollback.js          | 6 +++++-
 11 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/deploy/tencentDeploy.js b/deploy/tencentDeploy.js
index 2aa2772..f983f7a 100644
--- a/deploy/tencentDeploy.js
+++ b/deploy/tencentDeploy.js
@@ -27,7 +27,11 @@ class TencentDeploy {
 
   async deploy() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/deploy/tencentDeployFunction.js b/deploy/tencentDeployFunction.js
index efe9de4..66b452f 100644
--- a/deploy/tencentDeployFunction.js
+++ b/deploy/tencentDeployFunction.js
@@ -32,7 +32,11 @@ class TencentDeployFunction {
 
   async deploy() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/deploy/tencentDeployList.js b/deploy/tencentDeployList.js
index 6e3b8fa..18e728e 100644
--- a/deploy/tencentDeployList.js
+++ b/deploy/tencentDeployList.js
@@ -24,7 +24,11 @@ class TencentDeployList {
 
   async serviceList() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/deploy/tencentDeployListFunctions.js b/deploy/tencentDeployListFunctions.js
index ee1b972..ff7a042 100644
--- a/deploy/tencentDeployListFunctions.js
+++ b/deploy/tencentDeployListFunctions.js
@@ -26,7 +26,11 @@ class TencentDeployListFunction {
 
   async functionList() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/info/tencentInfo.js b/info/tencentInfo.js
index 27aae16..e0fe449 100644
--- a/info/tencentInfo.js
+++ b/info/tencentInfo.js
@@ -25,7 +25,11 @@ class TencentInfo {
 
   async info() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/invoke/tencentInvoke.js b/invoke/tencentInvoke.js
index c890338..d796f72 100644
--- a/invoke/tencentInvoke.js
+++ b/invoke/tencentInvoke.js
@@ -24,7 +24,11 @@ class TencentInvoke {
 
   async invoke() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/logs/tencentLogs.js b/logs/tencentLogs.js
index 9a050ac..7686914 100644
--- a/logs/tencentLogs.js
+++ b/logs/tencentLogs.js
@@ -50,7 +50,11 @@ class TencentLogs {
 
   async logs() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/metrics/tencentMetrics.js b/metrics/tencentMetrics.js
index b3eee65..a820076 100644
--- a/metrics/tencentMetrics.js
+++ b/metrics/tencentMetrics.js
@@ -58,7 +58,11 @@ class TencentInfo {
 
   async metrics() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/package.json b/package.json
index c2a24f5..8ba25b3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.26",
+  "version": "0.1.27",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
diff --git a/remove/tencentRemove.js b/remove/tencentRemove.js
index 4d41a8d..cb57ac5 100644
--- a/remove/tencentRemove.js
+++ b/remove/tencentRemove.js
@@ -25,7 +25,11 @@ class TencentRemove {
 
   async remove() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,
diff --git a/rollback/tencentRollback.js b/rollback/tencentRollback.js
index 9c6c7e1..fb03a70 100644
--- a/rollback/tencentRollback.js
+++ b/rollback/tencentRollback.js
@@ -27,7 +27,11 @@ class TencentRollback {
 
   async rollback() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (!this.options.credentials || !this.options.credentials.tencent_secret_id) {
+    if (
+      !this.options.credentials ||
+      !this.options.credentials.tencent_secret_id ||
+      !this.options.credentials.tencent_owneruin
+    ) {
       const tencentTemp = await provider.getTempKey()
       this.options.credentials = {
         tencent_secret_id: tencentTemp.tencent_secret_id,

From da0ef2d7b694c2dc838fb0d9a41226b52eaf5355 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Tue, 28 Jan 2020 10:38:03 +0800
Subject: [PATCH 05/14] fix auth

---
 deploy/tencentDeploy.js              | 16 +---------------
 deploy/tencentDeployFunction.js      | 16 +---------------
 deploy/tencentDeployList.js          | 17 ++---------------
 deploy/tencentDeployListFunctions.js | 17 ++---------------
 info/tencentInfo.js                  | 16 +---------------
 invoke/tencentInvoke.js              | 16 +---------------
 logs/tencentLogs.js                  | 16 +---------------
 metrics/tencentMetrics.js            | 16 +---------------
 package.json                         |  4 ++--
 provider/tencentProvider.js          | 25 ++++++++++++++++++++++++-
 remove/tencentRemove.js              | 16 +---------------
 rollback/tencentRollback.js          | 16 +---------------
 12 files changed, 38 insertions(+), 153 deletions(-)

diff --git a/deploy/tencentDeploy.js b/deploy/tencentDeploy.js
index f983f7a..48b6458 100644
--- a/deploy/tencentDeploy.js
+++ b/deploy/tencentDeploy.js
@@ -27,21 +27,7 @@ class TencentDeploy {
 
   async deploy() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
 
     const services = this.provider.getServiceResource()
diff --git a/deploy/tencentDeployFunction.js b/deploy/tencentDeployFunction.js
index 66b452f..5e1be36 100644
--- a/deploy/tencentDeployFunction.js
+++ b/deploy/tencentDeployFunction.js
@@ -32,21 +32,7 @@ class TencentDeployFunction {
 
   async deploy() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
 
     const services = this.provider.getServiceResource()
diff --git a/deploy/tencentDeployList.js b/deploy/tencentDeployList.js
index 18e728e..4484548 100644
--- a/deploy/tencentDeployList.js
+++ b/deploy/tencentDeployList.js
@@ -24,22 +24,9 @@ class TencentDeployList {
 
   async serviceList() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
+
     const Handler = new RollbackService(this.options, this.serverless)
     const fileKeyPrefix = this.serverless.service.service + '-' + this.options.stage
     const cosBucket = this.provider.getDeployCosBucket()
diff --git a/deploy/tencentDeployListFunctions.js b/deploy/tencentDeployListFunctions.js
index ff7a042..3ae3335 100644
--- a/deploy/tencentDeployListFunctions.js
+++ b/deploy/tencentDeployListFunctions.js
@@ -26,22 +26,9 @@ class TencentDeployListFunction {
 
   async functionList() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
+
     try {
       const infoHandler = new InfoFunction(this.options, this.serverless)
       const deployHandler = new ListFunctions(this.options, this.serverless)
diff --git a/info/tencentInfo.js b/info/tencentInfo.js
index e0fe449..380d0a8 100644
--- a/info/tencentInfo.js
+++ b/info/tencentInfo.js
@@ -25,21 +25,7 @@ class TencentInfo {
 
   async info() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
     try {
       const region = this.options.region
diff --git a/invoke/tencentInvoke.js b/invoke/tencentInvoke.js
index d796f72..4b5a1eb 100644
--- a/invoke/tencentInvoke.js
+++ b/invoke/tencentInvoke.js
@@ -24,21 +24,7 @@ class TencentInvoke {
 
   async invoke() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
     try {
       const options = {
diff --git a/logs/tencentLogs.js b/logs/tencentLogs.js
index 7686914..f9a9e3b 100644
--- a/logs/tencentLogs.js
+++ b/logs/tencentLogs.js
@@ -50,21 +50,7 @@ class TencentLogs {
 
   async logs() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
     try {
       const timeFormat = 'yyyy-MM-dd hh:mm:ss'
diff --git a/metrics/tencentMetrics.js b/metrics/tencentMetrics.js
index a820076..2ba4723 100644
--- a/metrics/tencentMetrics.js
+++ b/metrics/tencentMetrics.js
@@ -58,21 +58,7 @@ class TencentInfo {
 
   async metrics() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
     try {
       const Handler = new MetricsFunction(this.options, this.serverless)
diff --git a/package.json b/package.json
index 8ba25b3..b130c27 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.27",
+  "version": "0.1.28",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
@@ -44,7 +44,7 @@
     "tencentcloud-sdk-nodejs": "^3.0.87",
     "universal-analytics": "^0.4.20",
     "tencent-login": "^0.1.6",
-    "serverless-tencent-auth-tool": "^1.0.0"
+    "serverless-tencent-auth-tool": "^1.0.9"
   },
   "devDependencies": {
     "coveralls": "^3.0.5",
diff --git a/provider/tencentProvider.js b/provider/tencentProvider.js
index 6e605e9..7062a7d 100644
--- a/provider/tencentProvider.js
+++ b/provider/tencentProvider.js
@@ -56,10 +56,33 @@ class TencentProvider {
     return constants.providerName
   }
 
+  async getUserCred(options) {
+    if (!options.credentials || !options.credentials.tencent_secret_id) {
+      const tencentTemp = await this.getTempKey()
+      this.options.credentials = {
+        tencent_secret_id: tencentTemp.tencent_secret_id,
+        tencent_secret_key: tencentTemp.tencent_secret_key,
+        tencent_appid: tencentTemp.tencent_appid,
+        tencent_owneruin: tencentTemp.tencent_owneruin
+      }
+      options.token = tencentTemp.token
+      options.timestamp = tencentTemp.timestamp
+    }
+    if (!options.credentials.tencent_owneruin || !options.credentials.tencent_appid) {
+      const appid = await this.getAppid({
+        SecretId: options.credentials.tencent_secret_id,
+        SecretKey: options.credentials.tencent_secret_key
+      })
+      options.credentials.tencent_appid = appid.AppId
+      options.credentials.tencent_owneruin = appid.OwnerUin
+    }
+    return options
+  }
+
   async getUserAuth(uin) {
     try {
       const getUserAuthInfo = new GetUserAuthInfo()
-      const result = await getUserAuthInfo.isAuth(uin)
+      const result = await getUserAuthInfo.isAuth(uin, 'plugin')
       if (result['Error'] == true) {
         console.log('Failed to get real name authentication result.')
         process.exit(-1)
diff --git a/remove/tencentRemove.js b/remove/tencentRemove.js
index cb57ac5..8b19884 100644
--- a/remove/tencentRemove.js
+++ b/remove/tencentRemove.js
@@ -25,21 +25,7 @@ class TencentRemove {
 
   async remove() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
     try {
       const handler = new RemoveFunction(this.options, this.serverless)
diff --git a/rollback/tencentRollback.js b/rollback/tencentRollback.js
index fb03a70..ed21f8b 100644
--- a/rollback/tencentRollback.js
+++ b/rollback/tencentRollback.js
@@ -27,21 +27,7 @@ class TencentRollback {
 
   async rollback() {
     const provider = new tencentProvider(this.serverless, this.options)
-    if (
-      !this.options.credentials ||
-      !this.options.credentials.tencent_secret_id ||
-      !this.options.credentials.tencent_owneruin
-    ) {
-      const tencentTemp = await provider.getTempKey()
-      this.options.credentials = {
-        tencent_secret_id: tencentTemp.tencent_secret_id,
-        tencent_secret_key: tencentTemp.tencent_secret_key,
-        tencent_appid: tencentTemp.tencent_appid,
-        tencent_owneruin: tencentTemp.tencent_owneruin
-      }
-      this.options.token = tencentTemp.token
-      this.options.timestamp = tencentTemp.timestamp
-    }
+    this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
     const Handler = new RollbackService(this.options, this.serverless)
     const fileKeyPrefix = this.serverless.service.service + '-' + this.options.stage

From 215be0d96c4e6cc79f01aeab238a6837579ff5d7 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Tue, 28 Jan 2020 16:33:58 +0800
Subject: [PATCH 06/14] add uin

---
 package.json | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package.json b/package.json
index b130c27..b00ed7f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.28",
+  "version": "0.1.29",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
@@ -44,7 +44,8 @@
     "tencentcloud-sdk-nodejs": "^3.0.87",
     "universal-analytics": "^0.4.20",
     "tencent-login": "^0.1.6",
-    "serverless-tencent-auth-tool": "^1.0.9"
+    "serverless-tencent-tools": "^0.0.9",
+    "serverless-tencent-auth-tool": "^1.0.12"
   },
   "devDependencies": {
     "coveralls": "^3.0.5",

From d952625ffd70270059660d57ab6861b19a37b261 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Tue, 28 Jan 2020 16:44:04 +0800
Subject: [PATCH 07/14] update version

---
 package.json | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package.json b/package.json
index b00ed7f..c898ab3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.29",
+  "version": "0.1.30",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
@@ -44,8 +44,8 @@
     "tencentcloud-sdk-nodejs": "^3.0.87",
     "universal-analytics": "^0.4.20",
     "tencent-login": "^0.1.6",
-    "serverless-tencent-tools": "^0.0.9",
-    "serverless-tencent-auth-tool": "^1.0.12"
+    "serverless-tencent-tools": "^0.0.10",
+    "serverless-tencent-auth-tool": "^1.0.13"
   },
   "devDependencies": {
     "coveralls": "^3.0.5",

From bd3bbf7caf0d63c28e3b2ca34af5e3fe0f506939 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Sun, 2 Feb 2020 14:52:49 +0800
Subject: [PATCH 08/14] add uin

---
 deploy/tencentDeployFunction.js | 19 +++++++++++++++++--
 package.json                    |  2 +-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/deploy/tencentDeployFunction.js b/deploy/tencentDeployFunction.js
index 5e1be36..6a5c6d5 100644
--- a/deploy/tencentDeployFunction.js
+++ b/deploy/tencentDeployFunction.js
@@ -79,6 +79,22 @@ class TencentDeployFunction {
     const oldFunc = await func.deploy('default', funcObject)
     this.serverless.cli.log(`Created function ${funcObject.FuncName}`)
 
+    // when update code Status is Active, continue
+    let status = 'Updating'
+    let times = 90
+    while (status == 'Updating' || status == 'Creating') {
+      const tempFunc = await func.getFunction('default', funcObject.FuncName)
+      status = tempFunc.Status
+      await utils.sleep(1000)
+      times = times - 1
+      if (times <= 0) {
+        throw `Function ${funcObject.FuncName} create/update failed`
+      }
+    }
+    if (status != 'Active') {
+      throw `Function ${funcObject.FuncName} create/update failed`
+    }
+
     this.serverless.cli.log(`Updating configure for function ${funcObject.FuncName}`)
     await func.updateConfiguration('default', oldFunc, funcObject)
 
@@ -86,8 +102,7 @@ class TencentDeployFunction {
     await func.createTags('default', funcObject.FuncName, funcObject.Properties.Tags)
 
     // Function status
-    let status = 'Updating'
-    let times = 90
+    status = 'Updating'
     while (status == 'Updating' || status == 'Creating') {
       const tempFunc = await func.getFunction('default', funcObject.FuncName)
       status = tempFunc.Status
diff --git a/package.json b/package.json
index c898ab3..d25653c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.30",
+  "version": "0.1.33",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",

From 52f428013e5808e73dc627dbef7b404cfee32295 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Tue, 4 Feb 2020 12:54:18 +0800
Subject: [PATCH 09/14] fix auth

---
 provider/tencentProvider.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/provider/tencentProvider.js b/provider/tencentProvider.js
index 7062a7d..62ec223 100644
--- a/provider/tencentProvider.js
+++ b/provider/tencentProvider.js
@@ -82,7 +82,7 @@ class TencentProvider {
   async getUserAuth(uin) {
     try {
       const getUserAuthInfo = new GetUserAuthInfo()
-      const result = await getUserAuthInfo.isAuth(uin, 'plugin')
+      const result = await getUserAuthInfo.isAuth(uin, { client: 'plugin' })
       if (result['Error'] == true) {
         console.log('Failed to get real name authentication result.')
         process.exit(-1)

From 50936a70e8739a386934294a12db45ef2e096393 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Fri, 7 Feb 2020 08:54:10 +0800
Subject: [PATCH 10/14] fix status

---
 .eslintrc.js                    |  1 -
 Changelog.md                    |  6 ++++++
 deploy/lib/deployFunction.js    | 26 +++++++++++++-------------
 deploy/tencentDeploy.js         | 14 +-------------
 deploy/tencentDeployFunction.js | 27 ++-------------------------
 invoke/tencentInvoke.js         |  3 ---
 package.json                    |  6 +++---
 provider/tencentProvider.js     | 25 +++++++++++++++++++++++--
 rollback/tencentRollback.js     |  8 ++++++++
 9 files changed, 56 insertions(+), 60 deletions(-)

diff --git a/.eslintrc.js b/.eslintrc.js
index 60a9b4f..420e593 100755
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -43,7 +43,6 @@ module.exports = {
       }
     ],
     'no-alert': 'error',
-    'no-console': 'error',
     'no-const-assign': 'error',
     'no-else-return': 'error',
     'no-empty': 'off',
diff --git a/Changelog.md b/Changelog.md
index e44ee92..d6298a7 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,4 +1,10 @@
 # 变更历史
 
+
+
+## 2020-02-06
+* 修复rollback操作可能出现函数状态错误问题
+* 优化函数状态检测部分代码
+
 ## 2019-11-26
 * 更新函数状态，提高部署成功率
diff --git a/deploy/lib/deployFunction.js b/deploy/lib/deployFunction.js
index 57ac525..e206538 100644
--- a/deploy/lib/deployFunction.js
+++ b/deploy/lib/deployFunction.js
@@ -21,19 +21,7 @@ class DeployFunction extends AbstractHandler {
       }
       this.serverless.cli.log('Updating code... ')
       await this.updateFunctionCode(ns, funcObject)
-      // when update code Status is Active, continue
-      let status = 'Updating'
-      let times = 90
-      while (status == 'Updating' || status == 'Creating') {
-        const tempFunc = await this.getFunction(ns, funcObject.FuncName)
-        status = tempFunc.Status
-        await utils.sleep(1000)
-        times = times - 1
-        if (times <= 0) {
-          throw `Function ${funcObject.FuncName} update failed`
-        }
-      }
-      if (status != 'Active') {
+      if ((await this.checkStatus(ns, funcObject)) == false) {
         throw `Function ${funcObject.FuncName} update failed`
       }
       this.serverless.cli.log('Updating configure... ')
@@ -43,6 +31,18 @@ class DeployFunction extends AbstractHandler {
     return null
   }
 
+  async checkStatus(ns, funcObject) {
+    let status = 'Updating'
+    let times = 90
+    while ((status == 'Updating' || status == 'Creating') && times > 0) {
+      const tempFunc = await this.getFunction(ns, funcObject.FuncName)
+      status = tempFunc.Status
+      await utils.sleep(1000)
+      times = times - 1
+    }
+    return status != 'Active' ? false : true
+  }
+
   async addRole() {
     try {
       const roleName = 'SCF_QcsRole'
diff --git a/deploy/tencentDeploy.js b/deploy/tencentDeploy.js
index 48b6458..3e3f28a 100644
--- a/deploy/tencentDeploy.js
+++ b/deploy/tencentDeploy.js
@@ -66,19 +66,7 @@ class TencentDeploy {
       this.serverless.cli.log(`Setting tags for function ${funcObject.FuncName}`)
       await func.createTags('default', funcObject.FuncName, funcObject.Properties.Tags)
 
-      // Function status
-      let status = 'Updating'
-      let times = 90
-      while (status == 'Updating' || status == 'Creating') {
-        const tempFunc = await func.getFunction('default', funcObject.FuncName)
-        status = tempFunc.Status
-        await utils.sleep(1000)
-        times = times - 1
-        if (times <= 0) {
-          throw `Function ${funcObject.FuncName} create/update failed`
-        }
-      }
-      if (status != 'Active') {
+      if ((await func.checkStatus('default', funcObject)) == false) {
         throw `Function ${funcObject.FuncName} create/update failed`
       }
 
diff --git a/deploy/tencentDeployFunction.js b/deploy/tencentDeployFunction.js
index 6a5c6d5..137c460 100644
--- a/deploy/tencentDeployFunction.js
+++ b/deploy/tencentDeployFunction.js
@@ -79,19 +79,7 @@ class TencentDeployFunction {
     const oldFunc = await func.deploy('default', funcObject)
     this.serverless.cli.log(`Created function ${funcObject.FuncName}`)
 
-    // when update code Status is Active, continue
-    let status = 'Updating'
-    let times = 90
-    while (status == 'Updating' || status == 'Creating') {
-      const tempFunc = await func.getFunction('default', funcObject.FuncName)
-      status = tempFunc.Status
-      await utils.sleep(1000)
-      times = times - 1
-      if (times <= 0) {
-        throw `Function ${funcObject.FuncName} create/update failed`
-      }
-    }
-    if (status != 'Active') {
+    if ((await func.checkStatus('default', funcObject)) == false) {
       throw `Function ${funcObject.FuncName} create/update failed`
     }
 
@@ -101,18 +89,7 @@ class TencentDeployFunction {
     this.serverless.cli.log(`Setting tags for function ${funcObject.FuncName}`)
     await func.createTags('default', funcObject.FuncName, funcObject.Properties.Tags)
 
-    // Function status
-    status = 'Updating'
-    while (status == 'Updating' || status == 'Creating') {
-      const tempFunc = await func.getFunction('default', funcObject.FuncName)
-      status = tempFunc.Status
-      await utils.sleep(1000)
-      times = times - 1
-      if (times <= 0) {
-        throw `Function ${funcObject.FuncName} create/update failed`
-      }
-    }
-    if (status != 'Active') {
+    if ((await func.checkStatus('default', funcObject)) == false) {
       throw `Function ${funcObject.FuncName} create/update failed`
     }
 
diff --git a/invoke/tencentInvoke.js b/invoke/tencentInvoke.js
index 4b5a1eb..0ac662f 100644
--- a/invoke/tencentInvoke.js
+++ b/invoke/tencentInvoke.js
@@ -27,9 +27,6 @@ class TencentInvoke {
     this.options = await provider.getUserCred(this.options)
     await provider.getUserAuth(this.options.credentials.tencent_owneruin)
     try {
-      const options = {
-        region: this.options.region
-      }
       const invokeHandler = new Invoke(this.options, this.serverless)
       let context = null
       if (this.options.data) {
diff --git a/package.json b/package.json
index d25653c..5f00ddd 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.33",
+  "version": "0.1.34",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
@@ -44,8 +44,8 @@
     "tencentcloud-sdk-nodejs": "^3.0.87",
     "universal-analytics": "^0.4.20",
     "tencent-login": "^0.1.6",
-    "serverless-tencent-tools": "^0.0.10",
-    "serverless-tencent-auth-tool": "^1.0.13"
+    "serverless-tencent-tools": "^0.0.11",
+    "serverless-tencent-auth-tool": "^1.0.18"
   },
   "devDependencies": {
     "coveralls": "^3.0.5",
diff --git a/provider/tencentProvider.js b/provider/tencentProvider.js
index 62ec223..c632606 100644
--- a/provider/tencentProvider.js
+++ b/provider/tencentProvider.js
@@ -7,11 +7,14 @@ const util = require('util')
 const QRCode = require('qrcode')
 const TencentLogin = require('tencent-login')
 const tencentcloud = require('tencentcloud-sdk-nodejs')
-const { GetUserAuthInfo } = require('serverless-tencent-tools').Account
+const serverlessTencentTools = require('serverless-tencent-tools')
+const { GetUserAuthInfo } = serverlessTencentTools.Account
+const { DataReport } = serverlessTencentTools.Others.DataReport
 const ClientProfile = require('tencentcloud-sdk-nodejs/tencentcloud/common/profile/client_profile.js')
 const HttpProfile = require('tencentcloud-sdk-nodejs/tencentcloud/common/profile/http_profile.js')
 const AbstractModel = require('tencentcloud-sdk-nodejs/tencentcloud/common/abstract_model')
 const AbstractClient = require('tencentcloud-sdk-nodejs/tencentcloud/common/abstract_client')
+
 const constants = {
   providerName: 'tencent'
 }
@@ -50,6 +53,19 @@ class TencentProvider {
     this.getCredentials(this.serverless, this.options)
     this.serverless.setProvider(constants.providerName, this)
     this.provider = this
+    let commands = ''
+    const commandsAttr = this.serverless.pluginManager.cliCommands
+    for (let i = 0; i < commandsAttr.length; i++) {
+      commands = commands + (i == 0 ? '' : '_') + commandsAttr[i]
+    }
+    this.reportInputs = {
+      name: 'serverless-tencent-scf',
+      project: this.serverless.service.service,
+      action: commands
+    }
+    try {
+      new DataReport().report(this.reportInputs)
+    } catch (e) {}
   }
 
   static getProviderName() {
@@ -75,14 +91,19 @@ class TencentProvider {
       })
       options.credentials.tencent_appid = appid.AppId
       options.credentials.tencent_owneruin = appid.OwnerUin
+      this.tempUin = appid.OwnerUin
     }
     return options
   }
 
   async getUserAuth(uin) {
     try {
+      try {
+        this.reportInputs.uin = uin
+        new DataReport().report(this.reportInputs)
+      } catch (e) {}
       const getUserAuthInfo = new GetUserAuthInfo()
-      const result = await getUserAuthInfo.isAuth(uin, { client: 'plugin' })
+      const result = await getUserAuthInfo.isAuth(uin, this.reportInputs)
       if (result['Error'] == true) {
         console.log('Failed to get real name authentication result.')
         process.exit(-1)
diff --git a/rollback/tencentRollback.js b/rollback/tencentRollback.js
index ed21f8b..440156a 100644
--- a/rollback/tencentRollback.js
+++ b/rollback/tencentRollback.js
@@ -88,9 +88,17 @@ class TencentRollback {
               const oldFunc = await func.deploy('default', funcObject)
               this.serverless.cli.log(`Rollback function ${funcObject.FuncName}`)
 
+              if ((await func.checkStatus('default', funcObject)) == false) {
+                throw `Function ${funcObject.FuncName} create/update failed`
+              }
+
               this.serverless.cli.log(`Rollback configure for function ${funcObject.FuncName}`)
               await func.updateConfiguration('default', oldFunc, funcObject)
 
+              if ((await func.checkStatus('default', funcObject)) == false) {
+                throw `Function ${funcObject.FuncName} create/update failed`
+              }
+
               this.serverless.cli.log(`Setting tags for function ${funcObject.FuncName}`)
               await func.createTags('default', funcObject.FuncName, funcObject.Properties.Tags)
 

From 3fe49113746ba3184e5520e4ec842059e3525682 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Fri, 7 Feb 2020 15:05:18 +0800
Subject: [PATCH 11/14] fix cos_client

---
 Changelog.md      |  2 ++
 package.json      |  2 +-
 shared/handler.js | 30 ++++++++++--------------------
 3 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/Changelog.md b/Changelog.md
index d6298a7..185fea1 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,6 +1,8 @@
 # 变更历史
 
 
+## 2020-02-06
+* 优化COS实例创建代码
 
 ## 2020-02-06
 * 修复rollback操作可能出现函数状态错误问题
diff --git a/package.json b/package.json
index 5f00ddd..216d01a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.34",
+  "version": "0.1.35",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
diff --git a/shared/handler.js b/shared/handler.js
index c352978..149db09 100644
--- a/shared/handler.js
+++ b/shared/handler.js
@@ -11,7 +11,6 @@ const MonitorClinet = tencentcloud.monitor.v20180724.Client
 
 class AbstractHandler {
   constructor(options, serverless) {
-
     const { credentials, region } = options
     const { tencent_appid, tencent_secret_id, tencent_secret_key } = credentials
     this.options = options
@@ -98,26 +97,17 @@ class AbstractHandler {
     const chunkSize = options.chunkSize || 1024 * 1024 * 8
     const timeout = options.timeout || 120
 
-    if (!options.token) {
-      return new tencentcloudCos({
-        SecretId: secret_id,
-        SecretKey: secret_key,
-        FileParallelLimit: fileParallelLimit,
-        ChunkParallelLimit: chunkParallelLimit,
-        ChunkSize: chunkSize,
-        Timeout: timeout * 1000
-      })
-    }
-
     return new tencentcloudCos({
-      getAuthorization: function(option, callback) {
-        callback({
-          TmpSecretId: secret_id,
-          TmpSecretKey: secret_key,
-          XCosSecurityToken: options.token,
-          ExpiredTime: options.timestamp
-        })
-      }
+      SecretId: secret_id,
+      SecretKey: secret_key,
+      FileParallelLimit: fileParallelLimit,
+      ChunkParallelLimit: chunkParallelLimit,
+      ChunkSize: chunkSize,
+      Timeout: timeout * 1000,
+      TmpSecretId: secret_id,
+      TmpSecretKey: secret_key,
+      XCosSecurityToken: options.token,
+      ExpiredTime: options.timestamp
     })
   }
 

From ed06754bf02edb48ac32c0ea884095ef0fef6b02 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Sat, 8 Feb 2020 11:36:07 +0800
Subject: [PATCH 12/14] fix status

---
 deploy/tencentDeploy.js         | 6 ++++++
 deploy/tencentDeployFunction.js | 3 +++
 package.json                    | 2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/deploy/tencentDeploy.js b/deploy/tencentDeploy.js
index 3e3f28a..01eec4d 100644
--- a/deploy/tencentDeploy.js
+++ b/deploy/tencentDeploy.js
@@ -112,11 +112,17 @@ class TencentDeploy {
       if (this.options.function && this.options.function != funcName) {
         continue
       }
+      const funcObject = _.cloneDeep(services.Resources.default[funcName])
+      funcObject.Name = funcName
+      funcObject.FuncName = this.provider.getFunctionName(funcName)
       const deployFunctionName = this.provider.getFunctionName(funcName)
       outputInformation = outputInformation + `  ${funcName}: ${deployFunctionName}\n`
       functionInformation = await func.getFunction('default', deployFunctionName, false)
       if (functionInformation.Triggers && functionInformation.Triggers.length > 0) {
         for (let i = 0; i <= functionInformation.Triggers.length; i++) {
+          if ((await func.checkStatus('default', funcObject)) == false) {
+            throw `Function ${funcObject.FuncName} create/update failed`
+          }
           const thisTrigger = functionInformation.Triggers[i]
           try {
             if (thisTrigger.Type == 'apigw') {
diff --git a/deploy/tencentDeployFunction.js b/deploy/tencentDeployFunction.js
index 137c460..01ed6f2 100644
--- a/deploy/tencentDeployFunction.js
+++ b/deploy/tencentDeployFunction.js
@@ -130,6 +130,9 @@ class TencentDeployFunction {
     const functionInformation = await func.getFunction('default', deployFunctionName, false)
     if (functionInformation.Triggers && functionInformation.Triggers.length > 0) {
       for (let i = 0; i <= functionInformation.Triggers.length; i++) {
+        if ((await func.checkStatus('default', funcObject)) == false) {
+          throw `Function ${funcObject.FuncName} create/update failed`
+        }
         const thisTrigger = functionInformation.Triggers[i]
         try {
           if (thisTrigger.Type == 'apigw') {
diff --git a/package.json b/package.json
index 216d01a..144ca26 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.35",
+  "version": "0.1.36",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",

From a37c7eff620e24e069745a6af6481c27e8a2fb70 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Mon, 10 Feb 2020 08:37:29 +0800
Subject: [PATCH 13/14] fix status

---
 package.json                |  2 +-
 provider/tencentProvider.js | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/package.json b/package.json
index 144ca26..bbdc032 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-tencent-scf",
-  "version": "0.1.36",
+  "version": "0.1.37",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.",
   "main": "index.js",
   "author": "Tencent Cloud, Inc.",
diff --git a/provider/tencentProvider.js b/provider/tencentProvider.js
index c632606..3cb97e7 100644
--- a/provider/tencentProvider.js
+++ b/provider/tencentProvider.js
@@ -105,7 +105,7 @@ class TencentProvider {
       const getUserAuthInfo = new GetUserAuthInfo()
       const result = await getUserAuthInfo.isAuth(uin, this.reportInputs)
       if (result['Error'] == true) {
-        console.log('Failed to get real name authentication result.')
+        console.log('未获取到实名认证结果，请重试。')
         process.exit(-1)
       } else {
         if (result['Message']['Authentication'] == 1) {
@@ -113,15 +113,15 @@ class TencentProvider {
         }
         const verifyUrl = 'https://cloud.tencent.com/verify/identity'
         console.log(
-          "You don't have real name authentication yet. You can open the url or scan QR code for real name authentication."
+          '系统检测您还未进行实名认证，请您扫描二下方二维码或者进入下方的地址，进行实名认证，实名认证之后可重新操作。'
         )
-        console.log('Real name authentication url: ')
+        console.log('实名认证地址: ')
         console.log('https://console.cloud.tencent.com/developer/auth')
-        console.log('Real name authentication QR code: ')
+        console.log('实名认证二维码: ')
         QRCode.toString(verifyUrl, { type: 'terminal' }, function(err, url) {
           console.log(url)
         })
-        console.log('Please re operate after real name authentication.')
+        console.log('请实名认证之后，重新执行本次操作。')
         process.exit(-1)
       }
     } catch (e) {

From b4bd6de5865c942e0163d6182e894c9472827ae7 Mon Sep 17 00:00:00 2001
From: dfounderliu <dfounderliu@tencent.com>
Date: Mon, 24 Feb 2020 18:35:11 +0800
Subject: [PATCH 14/14] fix readme

---
 index.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/index.js b/index.js
index feb1846..8aa36de 100755
--- a/index.js
+++ b/index.js
@@ -27,7 +27,6 @@ class TencentIndex {
     this.serverless.pluginManager.addPlugin(TencentInfo)
     this.serverless.pluginManager.addPlugin(TencentLogs)
   }
-
 }
 
 module.exports = TencentIndex
