Comments (2)
Thank you so much!
I catch error with fetch (i gave additional invalid mode=cors header param, it's works on local dev but fails on worker)
And finally i make it works with context.env.BINDING KV access in loader, thank you, i understood about module worker difference, planning to dig deeper to Durable Objects, thank you so much for showing me the way ) and big thanks for excellent quality template)
from remix-cloudflare-template.
Hi @sinitsa,
I have tested fetch(), and axios request - in routes files - everything same - at worker, any request did't get any response... at local dev (miniflare) everything ok ....
I am not sure exactly what's the problem you had here. I haven't try using axios with worker myself. But I do think it might be hard to get it working correctly on the Worker runtime. I would strongly suggest using the native fetch instead.
and by the way, how i can use Cloudflare KV read/writ in *.server.ts files? I have added everything as usually but in this template seems like something works bit different...
I guess you might be trying to access the KV bindings as global variables. However, this approach is limited to service worker
(which the official remix worker template is based on), while this template is setup as a module worker
. You can find out more details about module worker here. I understand this is probably quite confusing to new users experimenting Cloudlfare Workers. But in general, you can consider module worker
as the latest and suggested approach going forward to implement your workers logic. There are also additional benefits with this approach. For example, module workers
support Durable Objects and works with Pages directly as well.
Back to your question, in order to access the KV binding, you will need to access it through the env
object similar to the example here. This approache should allow you to access it on loader
and action
which is usually where you need the data from KV.
Let me know if you have any more questions. It will be helpful if you can provide more details/code on how you are doing it.
from remix-cloudflare-template.
Related Issues (6)
- process is not defined HOT 3
- Direct routes accessing HOT 3
- Chakra UI integration HOT 4
- Is the package maintained? HOT 3
- How it works your playwright configuration. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remix-cloudflare-template.