Skip to content

Commit 8edecc8

Browse files
committed
fix(app-service): fix func_id type to ObjectId
1 parent ec1864f commit 8edecc8

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ services:
5454
SYS_SERVER_SECRET_SALT: Rewrite_Your_Own_Secret_Salt_abcdefg1234567
5555
SHARED_NETWORK: laf_shared_network
5656
LOG_LEVEL: debug
57-
APP_SERVICE_IMAGE: lafyun/app-service:0.6.8
57+
APP_SERVICE_IMAGE: lafyun/app-service:latest
5858
ACCOUNT_DEFAULT_APP_QUOTA: 5
5959
APP_SERVICE_DEPLOY_HOST: local-dev.host:8080 # `*.local-dev.host` always resolved to 127.0.0.1, used to local development
6060
APP_SERVICE_DEPLOY_URL_SCHEMA: 'http'

packages/app-service/src/lib/scheduler/scheduler.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
/*
22
* @Author: Maslow<[email protected]>
33
* @Date: 2021-07-30 10:30:29
4-
* @LastEditTime: 2021-09-09 22:59:48
4+
* @LastEditTime: 2021-11-05 14:46:49
55
* @Description:
66
*/
77

88
import { getFunctionById } from "../../api/function"
9-
import { addFunctionLog } from "../../api/function-log"
9+
import { addFunctionLog, CloudFunctionLogStruct } from "../../api/function-log"
1010
import { CloudFunction, TriggerScheduler } from "cloud-function-engine"
1111
import { createLogger } from "../logger"
1212
import assert = require("assert")
13+
import { ObjectId } from "bson"
1314

1415

1516
const logger = createLogger('scheduler')
@@ -41,7 +42,9 @@ export class FrameworkScheduler extends TriggerScheduler {
4142
* @override
4243
* @param data
4344
*/
44-
async addFunctionLog(data: any) {
45+
async addFunctionLog(data: CloudFunctionLogStruct) {
46+
// func_id from TriggerScheduler is string type, convert it to ObjectId
47+
data.func_id = new ObjectId(data.func_id)
4548
await addFunctionLog(data)
4649
}
4750

packages/cloud-function/src/trigger-scheduler.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class TriggerScheduler {
8787
* @returns
8888
*/
8989
protected async getFunctionById(_func_id: string): Promise<CloudFunction> {
90-
throw new Error('not implemented, you should drive TriggerScheduler class and override getFunctionById() method')
90+
throw new Error('not implemented, you should derive TriggerScheduler class and override getFunctionById() method')
9191
}
9292

9393
/**
@@ -105,7 +105,7 @@ export class TriggerScheduler {
105105
await this.addFunctionLog({
106106
requestId: `trigger_${trigger.id}`,
107107
method: param.method,
108-
func_id: func.id,
108+
func_id: func_id,
109109
func_name: func.name,
110110
logs: result.logs,
111111
time_usage: result.time_usage,

0 commit comments

Comments
 (0)