INNER CODE UNIT · JavaScript

budget

middyjs/middy · packages/cloudformation-response/index.js:140

	const budget = (context.getRemainingTimeInMillis?.() ?? 30_000) - 500;
	// The presigned URL was signed with an empty content type, so any other
	// value fails the bucket's signature check (same as the cfn-response module).
	// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-lambda-function-code-cfnresponsemodule.html
	const res = await fetch(url, {
		method: "PUT",
		headers: { "content-type": "" },
		body,
		signal: AbortSignal.timeout(Math.max(1000, budget)),
	});
	if (!res.ok) {
		throw new Error(
			`${pkg}: CloudFormation rejected the response (${res.status})`,
			{
				cause: { package: pkg, data: { status: res.status } },
			},
		);
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…