Skip to content

Commit d2899a7

Browse files
committed
fixed component param error
1 parent 0b79a00 commit d2899a7

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

sdk/serverless/index.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,28 +111,23 @@ class Serverless {
111111
if (!body.component || !body.component.componentName || !body.component.version) {
112112
throw new Error('componentName and version are required.')
113113
}
114-
const pubComponent = {
115-
ComponentName: body.component.componentName,
116-
ComponentVersion: body.component.version,
117-
Body: body
118-
}
119114

120115
const req = new SlsModels.PrePublishComponentRequest()
121-
req.from_json_string(JSON.stringify(pubComponent))
116+
req.ComponentVersion = body.component.version
117+
req.ComponentName = body.component.componentName
118+
req.Body = JSON.stringify(body)
122119
return await this._call('PrePublishComponent', req)
123120
}
124121

125122
async postPublishComponent(body = {}) {
126123
if (!body.componentName || !body.componentVersion) {
127124
throw new Error('componentName and componentVersion are required.')
128125
}
129-
const pubComponent = {
130-
ComponentName: body.componentName,
131-
ComponentVersion: body.componentVersion,
132-
Body: body
133-
}
126+
134127
const req = new SlsModels.PostPublishComponentRequest()
135-
req.from_json_string(JSON.stringify(pubComponent))
128+
req.ComponentVersion = body.componentVersion
129+
req.ComponentName = body.componentName
130+
req.Body = JSON.stringify(body)
136131
return await this._call('PostPublishComponent', req)
137132
}
138133

0 commit comments

Comments
 (0)