ASchmidIT
CDCloudflare Developers
•Created by niconiahi on 11/13/2023 in #pages-help
Recommended way of registering a Durable Object
Thanks, glad to hear that. I think it's a bit less than 99.9%. The big issue I run into is that Pages functions don't have a global context like Workers do. Hence accessing context via environment variables, as in KV, Durable Objects, etc. becomes an issue.
14 replies
CDCloudflare Developers
•Created by niconiahi on 11/13/2023 in #pages-help
Recommended way of registering a Durable Object
Hang on, isn't pages supposed to have "functions" which are the equivalent of workers? It was my understanding that in Remix code what is declared as loader and action functions will be converted to functions and will behave as a worker would. Is this not the case?
14 replies
CDCloudflare Developers
•Created by ASchmidIT on 11/10/2023 in #pages-help
Remix, Cloudflare Pages and Context/Env variables
8 replies
CDCloudflare Developers
•Created by ASchmidIT on 11/10/2023 in #pages-help
Remix, Cloudflare Pages and Context/Env variables
I think this Github issue here is exactly the problem:
8 replies
CDCloudflare Developers
•Created by ASchmidIT on 11/10/2023 in #pages-help
Remix, Cloudflare Pages and Context/Env variables
it works but if I take the server portion and put it in a server.ts file and call it via a function call it doesn't compile because the in server.ts "context.env.KV_NAME" ist not defined.
8 replies
CDCloudflare Developers
•Created by ASchmidIT on 11/10/2023 in #pages-help
Remix, Cloudflare Pages and Context/Env variables
export async function loader({
request, context, params
}: LoaderFunctionArgs) {
// Add from session server
// In this example the Cookie is created separately.
const sessionCookie = createCookie("_session", {
secrets: ["r3m1xr0ck5"],
sameSite: true,
});
const { getSession, commitSession, destroySession } =
createWorkersKVSessionStorage({
// The KV Namespace where you want to store sessions
// @ts-ignore
kv: context.env.KV,
cookie: sessionCookie,
});
// END added from server
8 replies
CDCloudflare Developers
•Created by ASchmidIT on 11/10/2023 in #pages-help
Remix, Cloudflare Pages and Context/Env variables
For example if I do in "login.tsx":
8 replies
CDCloudflare Developers
•Created by ASchmidIT on 11/10/2023 in #pages-help
Remix, Cloudflare Pages and Context/Env variables
That's correct and I have read all the documents I could but no go. The problem seems to be that context.env.KV_NAME is only available in a route context but not in a function context.
8 replies
CDCloudflare Developers
•Created by Marta00084 on 11/1/2023 in #pages-help
remix
I am just struggling with user auth with a Remix App deployed to CF Pages. The problem seems to be that most auth examples assume a long running node server at the backend and not a Pages function. Pages functions have missing context of the user session and hence working with sessions becomes difficult.
2 replies