@pattform/api-kit 2.6.4 → 2.6.5
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/dist/FormComponent.js +18 -13
- package/package.json +1 -1
package/dist/FormComponent.js
CHANGED
|
@@ -112,8 +112,24 @@ class FormComponent extends pulumi.ComponentResource {
|
|
|
112
112
|
provider: awsProvider,
|
|
113
113
|
parent: this,
|
|
114
114
|
});
|
|
115
|
+
// A Function URL with AuthType NONE is still private until a
|
|
116
|
+
// resource-based policy grants public invoke. The AWS Console adds this
|
|
117
|
+
// automatically; created via IaC it must be declared explicitly, or
|
|
118
|
+
// every browser POST is rejected with 403 Forbidden. Create it before
|
|
119
|
+
// the URL so the URL binds against an already-public function.
|
|
120
|
+
const urlPermission = new aws.lambda.Permission(`${baseName}-url-public-${env}`, {
|
|
121
|
+
action: "lambda:InvokeFunctionUrl",
|
|
122
|
+
function: this.lambda.name,
|
|
123
|
+
principal: "*",
|
|
124
|
+
functionUrlAuthType: "NONE",
|
|
125
|
+
}, {
|
|
126
|
+
provider: awsProvider,
|
|
127
|
+
parent: this,
|
|
128
|
+
});
|
|
115
129
|
// Preflight OPTIONS requests are answered by the Function URL itself;
|
|
116
130
|
// only same-configured origins can read responses from the browser.
|
|
131
|
+
// deleteBeforeReplace: a function may have only one URL config, so a
|
|
132
|
+
// replacement must delete the old one first (create-before-delete 409s).
|
|
117
133
|
this.functionUrl = new aws.lambda.FunctionUrl(`${baseName}-url-${env}`, {
|
|
118
134
|
functionName: this.lambda.name,
|
|
119
135
|
authorizationType: "NONE",
|
|
@@ -126,19 +142,8 @@ class FormComponent extends pulumi.ComponentResource {
|
|
|
126
142
|
}, {
|
|
127
143
|
provider: awsProvider,
|
|
128
144
|
parent: this,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// resource-based policy grants public invoke. The AWS Console adds this
|
|
132
|
-
// automatically; created via IaC it must be declared explicitly, or
|
|
133
|
-
// every browser POST is rejected with 403 Forbidden.
|
|
134
|
-
new aws.lambda.Permission(`${baseName}-url-public-${env}`, {
|
|
135
|
-
action: "lambda:InvokeFunctionUrl",
|
|
136
|
-
function: this.lambda.name,
|
|
137
|
-
principal: "*",
|
|
138
|
-
functionUrlAuthType: "NONE",
|
|
139
|
-
}, {
|
|
140
|
-
provider: awsProvider,
|
|
141
|
-
parent: this,
|
|
145
|
+
dependsOn: [urlPermission],
|
|
146
|
+
deleteBeforeReplace: true,
|
|
142
147
|
});
|
|
143
148
|
this.endpoint = this.functionUrl.functionUrl;
|
|
144
149
|
this.turnstileSiteKey = pulumi.output(turnstileSiteKey);
|