This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { LambdaClient, InvokeCommand, LogType } from "@aws-sdk/client-lambda"; | |
| const client = new LambdaClient({ | |
| region: process.env.AWS_REGION, | |
| maxAttempts: 1, | |
| }); | |
| const invoke = async (funcName, payload = {}) => { | |
| const command = new InvokeCommand({ | |
| FunctionName: funcName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| filter @message like /INIT_START|REPORT|START/ | | |
| parse @message /INIT_START Runtime Version: (?<runtime>\S+)/ | | |
| parse @message /^START RequestId: .* Version: (?<version>\S+)/ | | |
| stats sortslast(runtime) as `lambda runtime version`, sortslast(@initDuration) as iD, sortslast(version) as `software version` by @logStream | | |
| filter ispresent(`software version`) | | |
| stats pct(iD, 50) as p50, pct(iD, 90) as p90, pct(iD, 95) as p95, pct(iD, 99) as p99 by `lambda runtime version`, `software version` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { statSync } from "fs"; | |
| let runtimeBuildDate; | |
| try { | |
| runtimeBuildDate = statSync("/var/runtime").mtime; | |
| } catch (e) { | |
| console.error("Unable to determine runtime build date", e); | |
| } | |
| export const handler = async (event) => { | |
| const response = { | |
| statusCode: 200, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [toplevel] | |
| whoami = | |
| !f() { | |
| echo `als=$(aws iam list-account-aliases --query 'AccountAliases[0]' --output text) && \ | |
| echo "\033[0;33m$als\033[0m:";`\ | |
| `callerid=$(aws sts get-caller-identity --query 'Arn' --output text) && \ | |
| (echo $callerid | cut -d: -f5-6)` | |
| }; f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as esbuild from "esbuild"; | |
| import * as fs from "fs"; | |
| import * as path from "path"; | |
| // esbuild plugin to add and remove export from the handler function for cloudfront | |
| let cloudFrontFunctions = { | |
| name: "cloudFrontFunctions", | |
| setup(build) { | |
| const write = build.initialOptions.write; | |
| build.initialOptions.write = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/node_modules/serverless/lib/plugins/aws/invoke-local/index.js b/node_modules/serverless/lib/plugins/aws/invoke-local/index.js | |
| index b227110..6d10a53 100644 | |
| --- a/node_modules/serverless/lib/plugins/aws/invoke-local/index.js | |
| +++ b/node_modules/serverless/lib/plugins/aws/invoke-local/index.js | |
| @@ -838,12 +838,15 @@ class AwsInvokeLocal { | |
| if (error.code === 'ERR_REQUIRE_ESM') { | |
| return await require('../../../utils/import-esm')(`${modulePath}.js`); | |
| } else if (error.code === 'MODULE_NOT_FOUND') { | |
| - // Attempt to require handler with `.cjs` extension | |
| - pathToHandler = `${pathToHandler}.cjs`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| filter @type = 'REPORT' | | |
| stats sum(ispresent(@initDuration))/count()*100 as `% coldstarts`, | |
| sum((@initDuration+@duration)*ispresent(@initDuration))/sum(ispresent(@initDuration)) as `avg(coldstart)`, | |
| sum(@duration*(1-ispresent(@initDuration)))/sum(1-ispresent(@initDuration)) as `avg(noncoldstart)` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const crypto = require('crypto'); | |
| const querystring = require('querystring'); | |
| function hmac(key, string, encoding) { | |
| return crypto | |
| .createHmac('sha256', key) | |
| .update(string, 'utf8') | |
| .digest(encoding); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @aws-sdk/util-utf8-browser/dist-es/pureJs.js | |
| @aws-sdk/util-utf8-browser/dist-es/whatwgEncodingApi.js | |
| @aws-sdk/util-utf8-browser/dist-es/index.js | |
| @aws-crypto/crc32/build/index.js | |
| @smithy/util-hex-encoding/dist-es/index.js | |
| @smithy/eventstream-codec/dist-es/Int64.js | |
| @smithy/eventstream-codec/dist-es/HeaderMarshaller.js | |
| @smithy/eventstream-codec/dist-es/splitMessage.js | |
| @smithy/eventstream-codec/dist-es/EventStreamCodec.js | |
| @smithy/eventstream-codec/dist-es/MessageDecoderStream.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Print Markdown | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| print-markdown: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Print Markdown |
NewerOlder