sst 2.22.3 → 2.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/telemetry/post-payload.js +5 -1
- package/constructs/Function.js +15 -1
- package/package.json +1 -1
- package/sst.mjs +2 -1
|
@@ -2,7 +2,8 @@ import https from "https";
|
|
|
2
2
|
export function postPayload(endpoint, body) {
|
|
3
3
|
return new Promise((resolve, reject) => {
|
|
4
4
|
try {
|
|
5
|
-
const req = https
|
|
5
|
+
const req = https
|
|
6
|
+
.request(endpoint, {
|
|
6
7
|
method: "POST",
|
|
7
8
|
headers: { "content-type": "application/json" },
|
|
8
9
|
timeout: 5000,
|
|
@@ -12,6 +13,9 @@ export function postPayload(endpoint, body) {
|
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
resolve();
|
|
16
|
+
})
|
|
17
|
+
.on("error", () => {
|
|
18
|
+
// catches connect ECONNREFUSED while the below catch does not work as expected
|
|
15
19
|
});
|
|
16
20
|
req.write(JSON.stringify(body));
|
|
17
21
|
req.end();
|
package/constructs/Function.js
CHANGED
|
@@ -174,10 +174,24 @@ export class Function extends CDKFunction {
|
|
|
174
174
|
const bootstrap = await useBootstrap();
|
|
175
175
|
this.attachPermissions([
|
|
176
176
|
new PolicyStatement({
|
|
177
|
-
actions: ["iot
|
|
177
|
+
actions: ["iot:Connect", "iot:DescribeEndpoint"],
|
|
178
178
|
effect: Effect.ALLOW,
|
|
179
179
|
resources: ["*"],
|
|
180
180
|
}),
|
|
181
|
+
new PolicyStatement({
|
|
182
|
+
actions: ["iot:Receive", "iot:Publish"],
|
|
183
|
+
effect: Effect.ALLOW,
|
|
184
|
+
resources: [
|
|
185
|
+
`arn:aws:iot:${stack.region}:${stack.account}:topic/sst/*`,
|
|
186
|
+
],
|
|
187
|
+
}),
|
|
188
|
+
new PolicyStatement({
|
|
189
|
+
actions: ["iot:Subscribe"],
|
|
190
|
+
effect: Effect.ALLOW,
|
|
191
|
+
resources: [
|
|
192
|
+
`arn:aws:iot:${stack.region}:${stack.account}:topicfilter/sst/*`,
|
|
193
|
+
],
|
|
194
|
+
}),
|
|
181
195
|
new PolicyStatement({
|
|
182
196
|
actions: ["s3:*"],
|
|
183
197
|
effect: Effect.ALLOW,
|
package/package.json
CHANGED