Skip to content

Commit b4e51f3

Browse files
jackyalbonimrod-becker
authored andcommitted
fixing issue #4753
1 parent 2f678e4 commit b4e51f3

File tree

4 files changed

+15
-31
lines changed

4 files changed

+15
-31
lines changed

frontend/src/app/actions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ export async function updateFuncConfig(name, version, config) {
135135
await api.func.update_func({
136136
config: { name, version, ...config }
137137
});
138-
notify(`Func ${config.name} updated successfully`, 'success');
139-
loadFunc(config.name);
138+
notify(`Func ${name} updated successfully`, 'success');
139+
loadFunc(name);
140140

141141
} catch (error) {
142-
notify(`Func ${config.name} update failed`, 'error');
142+
notify(`Func ${name} update failed`, 'error');
143143
}
144144
}
145145

src/agent/func_services/func_node.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class FuncNode {
6262
});
6363
});
6464
const msg = {
65-
config: func.config,
65+
config: req.params.config,
6666
event: req.params.event,
6767
aws_config: req.params.aws_config,
6868
rpc_options: req.params.rpc_options,
@@ -73,9 +73,9 @@ class FuncNode {
7373
}
7474

7575
_load_func_code(req) {
76-
const name = req.params.name;
77-
const version = req.params.version;
78-
const code_sha256 = req.params.code_sha256;
76+
const name = req.params.config.name;
77+
const version = req.params.config.version;
78+
const code_sha256 = req.params.config.code_sha256;
7979
const version_dir = path.join(this.functions_path, name, version);
8080
const func_json_path = path.join(version_dir, 'func.json');
8181
// replacing the base64 encoded sha256 from using / to - in order to use as folder name
@@ -98,9 +98,10 @@ class FuncNode {
9898
.then(res => {
9999
func = res;
100100
if (code_sha256 !== func.config.code_sha256 ||
101-
req.params.code_size !== func.config.code_size) {
101+
req.params.config.code_size !== func.config.code_size) {
102102
throw new RpcError('FUNC_CODE_MISMATCH',
103-
`Function code does not match for ${func.name} version ${func.version} code_size ${func.config.code_size} code_sha256 ${func.config.code_sha256} requested code_size ${req.params.code_size} code_sha256 ${req.params.code_sha256}`);
103+
`Function code does not match for ${func.name} version ${func.version} code_size ${func.config.code_size} code_sha256 ${func.config.code_sha256}
104+
requested code_size ${req.params.config.code_size} code_sha256 ${req.params.config.code_sha256}`);
104105
}
105106
})
106107
.then(() => zip_utils.unzip_from_buffer(func[RPC_BUFFERS].zipfile))

src/api/func_node_api.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,10 @@ module.exports = {
1616
method: 'PUT',
1717
params: {
1818
type: 'object',
19-
required: [
20-
'name',
21-
'version',
22-
'code_size',
23-
'code_sha256'
24-
],
19+
required: ['config'],
2520
properties: {
26-
name: {
27-
type: 'string'
28-
},
29-
version: {
30-
type: 'string'
31-
},
32-
code_size: {
33-
type: 'integer'
34-
},
35-
code_sha256: {
36-
type: 'string'
21+
config: {
22+
$ref: 'func_api#/definitions/func_config'
3723
},
3824
event: {
3925
$ref: 'func_api#/definitions/event_type'

src/server/func_services/func_server.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,7 @@ function invoke_func(req) {
235235
const func = req.func;
236236
const node = node_allocator.allocate_node(func.pools);
237237
const params = {
238-
name: func.name,
239-
version: func.version,
240-
code_size: func.code_size,
241-
code_sha256: func.code_sha256,
238+
config: _get_func_info(func).config,
242239
event: req.params.event,
243240
aws_config: _make_aws_config(req),
244241
rpc_options: _make_rpc_options(req),
@@ -298,7 +295,7 @@ function _get_func_code_stream(req, func_code) {
298295
this.push(req.rpc_params[RPC_BUFFERS].zipfile);
299296
this.push(null);
300297
}
301-
});
298+
});
302299
} else if (func_code.s3_bucket && func_code.s3_key) {
303300
console.log(`reading function code from bucket ${func_code.s3_bucket} and key ${func_code.s3_key}`);
304301
const account_keys = req.account.access_keys[0];

0 commit comments

Comments
 (0)