Hmmmmm the `getRequestContext` can't be

Hmmmmm the getRequestContext can't be called within an actions.ts due to edge runtime requirement. Gana have to find another way to populate data to a client component.
9 Replies
Dario
Dario•9mo ago
I feel like you can use getRequestContext no problem from actions.ts as long as actions.ts is only imported from routes using the edge runtime.... I might be wrong though 😕
Mongy
MongyOP•9mo ago
so i have to do more testing but it seems like having a client component call an action using getRequestContext works when the client component is being called/rendered from a route using edge runtime
Mongy
MongyOP•9mo ago
currently not sure why im getting this ts error. I get the env variable so thats fine.
No description
Mongy
MongyOP•9mo ago
env.d.ts
interface CloudflareEnv {
D1DB: D1Database;
}
interface CloudflareEnv {
D1DB: D1Database;
}
Dario
Dario•9mo ago
ok that sounds promising 😄 I wonder if your .d.ts file being picked up correctly 🤔 naturally I guess you tried reloading the TS server/IDE right?
Mongy
MongyOP•9mo ago
the IDE im using is jetbrains' WebStorm, restarted it and restarted typescript service. Both times TS hasnt picked it up
Dario
Dario•9mo ago
do you have any imports in your d.ts file by any chance?
Mongy
MongyOP•9mo ago
i had D1Databas type imported, removed it and it fixed Appreciate the help as always!
Dario
Dario•9mo ago
no problem! 😄
Want results from more Discord servers?
Add your server