Replies: 1 comment
-
This would be great for me too. Right now I have to do this hacky variable hoisting: import { createRequestHandler } from "@remix-run/architect";
// HACK: Variable hoisting to provide request metadata to the Remix handler
// https://github.com/remix-run/remix/discussions/3904
let latestRequestContext;
const handleRequest = createRequestHandler({
build: build,
mode: process.env.NODE_ENV,
getLoadContext: () => {
return {
// Properties from Lambda event context
// https://docs.aws.amazon.com/lambda/latest/dg/nodejs-context.html
lambda: latestRequestContext
};
},
});
export const handler = async function (event, context) {
latestRequestContext = context;
return handleRequest(event, context);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the new or updated feature that you are suggesting?
In @remix-run/architect, the
context
from the second parameter provided to the AWS Lambda handler function should be available in thegetLoadContext
function.Why should this feature be included?
Various metadata is included in the secondary
context
parameter provided when a Lambda function is invoked. For example, theawsRequestId
for tracing, memory configuration, and authentication information if using Cognito as an authorizer in API Gateway, are inaccessible to the remix application without it being provided to thegetLoadContext
function.Beta Was this translation helpful? Give feedback.
All reactions