Chinoman10
Chinoman10
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
Oh since I never heard of it I just kinda ignored it 😅🙏
31 replies
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
So I'm guessing you didn't know that pages dev did the bindings for you? How were you accessing the DO from within the Pages then?
31 replies
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
You can see I'm getting the OAUTH_KV from env, which comes from the request.
31 replies
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
No description
31 replies
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
As long as they are declared in the wrangler.toml, yup!
31 replies
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
Well the binding is done with wrangler, which I've posted. Then whenever there's a GET/POST request, the ctx is provided which has the request, the env, the waitUntil util function, etc. The env has the bindings.
31 replies
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
Sure, I'll try that tomorrow morning 👍
31 replies
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
I'm not sure I follow? What's the issue with using D1 or KV without a framework? All the code is in the 'functions' folder, which is kinda like a Worker, so 🤷‍♂️ Everything works fine. KV's are a bit wonky on localhost, but D1's work magnificently well. Makes me love DB's when I previously hated their guts (got PTSD from prev. jobs).
31 replies
CDCloudflare Developers
Created by Chinoman10 on 7/27/2024 in #durable-objects
I have the weirdest situation going
This is the pages wrangler:
# Generated by Wrangler on Tue Apr 16 2024 16:41:52 GMT+0200 (Central European Summer Time)
name = "client-caoba-hotels"
pages_build_output_dir = "_site"
compatibility_date = "2024-06-30"

[dev]
port = 3000

[[kv_namespaces]]
binding = "OAUTH_KV"
id = "617510114b886"

[[d1_databases]]
binding = "RESERVATIONS_DB"
database_name = "caoba-stg"
database_id = "d339a2acae2e1"
preview_database_id = "d339a396acae2e1"

[[durable_objects.bindings]]
name = "ALARM_DO"
class_name = "AlarmDO"
script_name = "alarm-durable-object"

[env.production]
compatibility_date = "2024-06-30"

[env.production.vars]
JEKYLL_ENV = "production"
ENVIRONMENT = "production"
# ... other vars

[[env.production.d1_databases]]
binding = "RESERVATIONS_DB"
database_name = "caoba-prd"
database_id = "d339acae2e1"

[env.preview]
[env.preview.vars]
JEKYLL_ENV = "staging"
ENVIRONMENT = "preview"

[[env.preview.d1_databases]]
binding = "RESERVATIONS_DB"
database_name = "caoba-stg"
database_id = "d33e2e1"
# Generated by Wrangler on Tue Apr 16 2024 16:41:52 GMT+0200 (Central European Summer Time)
name = "client-caoba-hotels"
pages_build_output_dir = "_site"
compatibility_date = "2024-06-30"

[dev]
port = 3000

[[kv_namespaces]]
binding = "OAUTH_KV"
id = "617510114b886"

[[d1_databases]]
binding = "RESERVATIONS_DB"
database_name = "caoba-stg"
database_id = "d339a2acae2e1"
preview_database_id = "d339a396acae2e1"

[[durable_objects.bindings]]
name = "ALARM_DO"
class_name = "AlarmDO"
script_name = "alarm-durable-object"

[env.production]
compatibility_date = "2024-06-30"

[env.production.vars]
JEKYLL_ENV = "production"
ENVIRONMENT = "production"
# ... other vars

[[env.production.d1_databases]]
binding = "RESERVATIONS_DB"
database_name = "caoba-prd"
database_id = "d339acae2e1"

[env.preview]
[env.preview.vars]
JEKYLL_ENV = "staging"
ENVIRONMENT = "preview"

[[env.preview.d1_databases]]
binding = "RESERVATIONS_DB"
database_name = "caoba-stg"
database_id = "d33e2e1"
And this is the worker's wrangler.toml:
name = "alarm-durable-object"
main = "src/index.ts"
compatibility_date = "2024-07-12"

[[durable_objects.bindings]]
name = "AlarmDO"
class_name = "AlarmDO"

[[migrations]]
tag = "v1"
new_classes = ["AlarmDO"]
name = "alarm-durable-object"
main = "src/index.ts"
compatibility_date = "2024-07-12"

[[durable_objects.bindings]]
name = "AlarmDO"
class_name = "AlarmDO"

[[migrations]]
tag = "v1"
new_classes = ["AlarmDO"]
I truncated the IDs and removed most vars.
31 replies