t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/AWS/EFS/efs-handler.ts
Julius Marminge 108e01746c
Upgrade Effect and Alchemy betas (#4643)
Prepare Relay production infrastructure for the PlanetScale PS_20 HA topology, upgrade Effect and Alchemy to compatible betas, reconcile migration state, and preserve patched MCP session termination behavior.\n\nCo-authored-by: codex <codex@users.noreply.github.com>
2026-07-27 16:21:02 +02:00

52 lines
1.6 KiB
TypeScript

// Plain async Lambda handler (deployed with `isExternal: true` — no Effect
// runtime in the bundle) that exercises an EFS mount at /mnt/test.
import { promises as fs } from "node:fs";
const FILE = "/mnt/test/persist.txt";
export const handler = async (event: {
rawPath?: string;
requestContext?: { http?: { path?: string } };
queryStringParameters?: Record<string, string>;
}) => {
const path = event.rawPath ?? event.requestContext?.http?.path ?? "/";
try {
if (path === "/write") {
const content = event.queryStringParameters?.content ?? "hello-from-efs";
await fs.writeFile(FILE, content, "utf8");
return {
statusCode: 200,
headers: { "content-type": "application/json" },
body: JSON.stringify({ written: content }),
};
}
if (path === "/read") {
const content = await fs.readFile(FILE, "utf8");
return {
statusCode: 200,
headers: { "content-type": "application/json" },
body: JSON.stringify({
content,
marker: process.env.DEPLOY_MARKER ?? "unset",
}),
};
}
if (path === "/mount") {
const entries = await fs.readdir("/mnt/test");
return {
statusCode: 200,
headers: { "content-type": "application/json" },
body: JSON.stringify({ mounted: true, entries }),
};
}
return { statusCode: 200, body: "ok" };
} catch (error) {
return {
statusCode: 500,
headers: { "content-type": "application/json" },
body: JSON.stringify({ error: String(error) }),
};
}
};
export default handler;