@kirkelliott/zap 0.1.6 → 0.1.7
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/cli.js +25 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -152,6 +152,31 @@ program
|
|
|
152
152
|
const files = await walkZap(demoDir, 'demo');
|
|
153
153
|
await Promise.all(files.map(({ filePath, key }) => deployFile(b, filePath, key)));
|
|
154
154
|
});
|
|
155
|
+
program
|
|
156
|
+
.command('debug')
|
|
157
|
+
.description('show Lambda function URL auth config and resource-based policy')
|
|
158
|
+
.action(async () => {
|
|
159
|
+
const cfg = readConfig();
|
|
160
|
+
const region = cfg.region ?? 'us-east-1';
|
|
161
|
+
const fn = cfg.functionArn ?? cfg.function ?? 'zap-runtime';
|
|
162
|
+
const lambda = new client_lambda_1.LambdaClient({ region });
|
|
163
|
+
try {
|
|
164
|
+
const { AuthType, FunctionUrl } = await lambda.send(new client_lambda_1.GetFunctionUrlConfigCommand({ FunctionName: fn }));
|
|
165
|
+
console.log(`url: ${FunctionUrl}`);
|
|
166
|
+
console.log(`auth type: ${AuthType}`);
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
console.log('function url: not found -', err.message);
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
const { Policy } = await lambda.send(new client_lambda_1.GetPolicyCommand({ FunctionName: fn }));
|
|
173
|
+
console.log('\nresource policy:');
|
|
174
|
+
console.log(JSON.stringify(JSON.parse(Policy), null, 2));
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
console.log('\nresource policy: none -', err.message);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
155
180
|
program
|
|
156
181
|
.command('repair')
|
|
157
182
|
.description('re-apply Lambda Function URL public access permissions')
|