MCPcopy
hub / github.com/serverless/serverless / invoke

Method invoke

packages/serverless/lib/plugins/aws/invoke.js:99–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97 }
98
99 async invoke() {
100 const invocationType = this.options.type || 'RequestResponse'
101 if (invocationType !== 'RequestResponse') {
102 this.options.log = 'None'
103 } else {
104 this.options.log = this.options.log ? 'Tail' : 'None'
105 }
106
107 const params = {
108 FunctionName: this.options.functionObj.name,
109 InvocationType: invocationType,
110 LogType: this.options.log,
111 Payload: Buffer.from(JSON.stringify(this.options.data || {})),
112 }
113
114 if (this.options.context) {
115 params.ClientContext = Buffer.from(
116 JSON.stringify(this.options.context),
117 ).toString('base64')
118 }
119
120 if (this.options.qualifier) {
121 params.Qualifier = this.options.qualifier
122 }
123
124 if (this.options['tenant-id']) {
125 params.TenantId = this.options['tenant-id']
126 }
127
128 if (this.options['durable-execution-name']) {
129 params.DurableExecutionName = this.options['durable-execution-name']
130 }
131
132 return this.provider.request('Lambda', 'invoke', params)
133 }
134
135 // Normalize Lambda invoke payload to string for JSON.parse
136 // AWS Node SDK v3 returns `Uint8Array` for `Lambda.invoke` Payload, while

Callers 2

constructorMethod · 0.95

Calls 1

requestMethod · 0.80

Tested by

no test coverage detected