Skip to content

Commit

Permalink
fix(cli): fix function exec error (#1270)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyoct authored Jun 16, 2023
1 parent 78c1d79 commit e077f76
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cli/src/action/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export async function init(appid: string, options: { sync: boolean }) {
appid: app.appid,
invokeUrl: app.tls ? 'https://' + app.domain.domain : 'http://' + app.domain.domain,
function: {
debugToken: app.function_debug_token,
debugTokenExpire: timestamp + DEBUG_TOKEN_EXPIRE,
developToken: app.develop_token,
developTokenExpire: timestamp + DEBUG_TOKEN_EXPIRE,
},
storage: {
endpoint: app.storage.credentials.endpoint,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/action/function/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export async function exec(

const res = await invokeFunction(
appSchema.invokeUrl || '',
appSchema?.function?.debugToken,
appSchema?.function?.developToken,
funcName,
func,
options.method,
Expand Down
4 changes: 2 additions & 2 deletions cli/src/common/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export function checkApplication() {

export async function checkFunctionDebugToken() {
const appSchema = AppSchema.read()
const { debugToken, debugTokenExpire } = appSchema.function
const { developToken, developTokenExpire } = appSchema.function
let timestamp = Date.parse(new Date().toString()) / 1000
if (!debugToken || debugTokenExpire < timestamp) {
if (!developToken || developTokenExpire < timestamp) {
await AppSchema.refresh()
}
}
Expand Down
8 changes: 4 additions & 4 deletions cli/src/schema/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class AppSchema {
appid: string
invokeUrl?: string
function?: {
debugToken?: string
debugTokenExpire?: number
developToken?: string
developTokenExpire?: number
}
storage?: {
endpoint: string
Expand Down Expand Up @@ -41,8 +41,8 @@ export class AppSchema {
let timestamp = Date.parse(new Date().toString()) / 1000

appSchema.function = {
debugToken: app.function_debug_token,
debugTokenExpire: timestamp + DEBUG_TOKEN_EXPIRE,
developToken: app.develop_token,
developTokenExpire: timestamp + DEBUG_TOKEN_EXPIRE,
}

appSchema.storage = {
Expand Down

0 comments on commit e077f76

Please sign in to comment.