danboyle8637
danboyle8637
Explore posts from servers
CDCloudflare Developers
Created by danboyle8637 on 5/31/2024 in #pages-help
Service Worker not updating in production or staging - Maybe not Cloudflare??
Not sure if this is Cloudflare thing??. Browser thing?? But I update my service worker version to clear caches in users browsers and reset the worker. However... in dev tools when you look at the sw code it's showing an old version. For some reason the code is getting updated in the app but my service worker is not. This is happening in Chrome and Firefox. Safari picked up the change and registered the new SW successfully. Any ideas? Sounds like a browser thing or a caching thing in the browser or build maybe?? But I wanted to start here.
1 replies
CDCloudflare Developers
Created by danboyle8637 on 5/21/2024 in #workers-help
New Rate Limiting Binding - Impossible To Add New ENV Variables?
I just noticed this morning that if you’ve hooked up the new unsafe binding to the rate limiting feature… You cannot add ENV variables in the CF Dashboard. It always errors out with: binding USER_WORKER_RATE_LIMITER of type ratelimit must have an namespace_id specified (Code: 10021) What is the best course of action? Also if you create a secret via wrangler can you add that in the wrangler.toml and have the value be read corectly? Thanks for any help!
8 replies
SSolidJS
Created by danboyle8637 on 3/15/2024 in #support
Render Portal as Error Boundary Fallback?
I want to refactor my async code to use Suspense and Error Boundaries. But when a network request fails... I show an error dialog telling the user what happened and what to do next. This is rendered in a Portal. Can I just stick that component in the fallback of an Error Boundary and have it work the same?
2 replies
SSolidJS
Created by danboyle8637 on 12/29/2023 in #support
Newest Router... Error about missing the wrapper Router component
This is more of a curiosity question for me... I just updated to the newest router. I'm using Solid... not Solid Start... I have an App component that had my routes in it. All of the Route components were wrapped in the Router component and the App component was default exported. In my index.ts file I imported the App component and used it in the render call. But I kept getting an error stating my routes were not wrapped in a Router. Why was this not working? It seems you have to direct render the Router in the render call for the routes to work.
3 replies
CDCloudflare Developers
Created by danboyle8637 on 12/13/2023 in #workers-help
Thinking Outside The Box With Durable Objects
I'm not building this yet... but just thinking about an interesting way to use Durable Objects and alarms. What do you think of using alarms to allow users to set up alarms to message the app's service worker to kick off a push notification? Besides the alarm the DO will save the custom message the user wants sent back to them. I am just thinking about ways to schedule push notifications since this is a new topic for me.
4 replies
CDCloudflare Developers
Created by danboyle8637 on 12/6/2023 in #workers-help
Best Logging Solution for Small App
I'm a little confused by all the logging options for building custom logs in a Worker. At first I was leaning toward using Worker trace events. Then I read about queues and this seems like a much better option plus easier to reason about as well. What do you all suggest? Will queues replace trace events anyway once they are out of beta?
3 replies
CDCloudflare Developers
Created by danboyle8637 on 11/20/2023 in #workers-help
Logging and monitoring for exceptions
I don't want to use Sentry for this current project. It's a small private app with very limited memberships. I want to use Workers Trace Events and push my logs to an R2 bucket. I see in the docs how to accomplish this but I'm confused as to the roll or a Tail worker in the process? Here's what I'm thinking... I use Workers Trace Events and send custom console.logs only when my Workers hits a non-200 response. I can send the function that was being called and the endpoint that failed. But would this be better accomplished in a Tail Worker? Thanks for any help on getting some simple exception logging setup.
1 replies
CDCloudflare Developers
Created by danboyle8637 on 10/21/2023 in #workers-help
Using Durable Objects in Dev Environment
In my wrangler.toml file I have this structure:
[env.dev]
vars = { ENVIRONMENT = "dev" }

[env.staging]
vars = { ENVIRONMENT = "staging" }

[env.production]
vars = { ENVIRONMENT = "production" }
[env.dev]
vars = { ENVIRONMENT = "dev" }

[env.staging]
vars = { ENVIRONMENT = "staging" }

[env.production]
vars = { ENVIRONMENT = "production" }
I created a Durable Object at the top level and I get this message when I launch my Worker in dev mode:
- "env.dev" environment configuration
- "durable_objects" exists at the top level, but not on "env.dev".
This is not what you probably want, since "durable_objects" is not inherited by
environments.
Please add "durable_objects" to "env.dev".
- "env.dev" environment configuration
- "durable_objects" exists at the top level, but not on "env.dev".
This is not what you probably want, since "durable_objects" is not inherited by
environments.
Please add "durable_objects" to "env.dev".
So I changed my configuration and added this under the dev section:
[env.dev]
vars = { ENVIRONMENT = "dev" }

[[durable_objects.bindings]]
name = "MEMBER_COUNT_DEV"
class_name = "MemberCount"

[[migrations]]
tag = "v1"
new_classes = ["MemberCount"]
[env.dev]
vars = { ENVIRONMENT = "dev" }

[[durable_objects.bindings]]
name = "MEMBER_COUNT_DEV"
class_name = "MemberCount"

[[migrations]]
tag = "v1"
new_classes = ["MemberCount"]
But I still get the same message. This is not how you add DOs to environments. What am I doing wrong. I followed a similar example in the docs about adding a KV store to multiple environments.
2 replies
SSolidJS
Created by danboyle8637 on 10/15/2023 in #support
Regular Solid - the Correct way to use createResource?
In my app, on my Dashboard view, I am using createResource to get my user data. I'm then just updating another user signal with data returned from the createResource. I'm doing this because this user signal is used through out the app... so when it's populated the correct data is displayed. But this has me thinking... why not just use regular fetch in an onMount to get the data and update the user signal. What is the correct way to use createResource? You don't want to have an "instance" of createResource all over your app do you? That doesn't make sense to me.
5 replies
CDCloudflare Developers
Created by danboyle8637 on 9/5/2023 in #workers-help
Building Webhook Best Practices (mainly for Stripe)
I am setting up my Stripe webhooks and I just want to confirm for best practices... Stripe mentions to respond with a 200 fast. I think the limit is 5 seconds before a retry is sent. When it comes to doing business logic with a Stripe event or any webhook event, should you always use waitUntil so the Worker responds with a 200 fast?
3 replies
CDCloudflare Developers
Created by danboyle8637 on 8/18/2023 in #pages-help
Use Service Bindings in local development
Is there a way to use a service binding... Pages Function to another Worker locally? The docs mention that is works but I can't find how to make it work. There is nothing further in the docs.
1 replies
CDCloudflare Developers
Created by danboyle8637 on 8/18/2023 in #pages-help
Bugs in Pages Functions?
I successfully deployed an Astro site to my Cloudflare Pages account. I'm not using SSR on this site. However, for my functions folder I'm getting two very strange behaviors. One of which I found a GitHub issue on . Sorry I don't have the link at the moment. 1. Wrangler CLI is complaining that the request is being cloned when it's not. If you do clone the request... use one of the requests... send the other to another Worker... you get two warnings of improperly cloning the request. 2. Invalid Headers I have a function route that errors immediately with a 500 and an invalid headers message. I'm not sending any custom headers. I'm not using any middleware to alter the request headers. Is anybody else seeing similar issues?
1 replies
CDCloudflare Developers
Created by danboyle8637 on 5/29/2023 in #pages-help
Wrangler CLI seems broken currently
I need to give permission to my worker and the cli opens the page to allow permission but then it goes to a broken localhost oauth url. But it can't find it. When I run wrangler login the same thing happens. I can log into my Cloudflare account fine. I tried updating the wrangler CLI package on my machine... npm update wrangler -g but the script just hangs. Anybody else experiencing any issues similar to this?
1 replies
CDCloudflare Developers
Created by danboyle8637 on 3/29/2023 in #workers-help
Using KV as a cache in the short term?
I am hooking up my backend to my frontend this weekend and eventually I want to use a service worker for caching. Until then I was planning on using KV as a cache for specific requests that don't change often. I was looking at the Cache API but since the cache only caches at the originating data center... it seems like KV would be a a better option. From a strategy perspective... is this a good move? Am I not thinking about something that I should be?
4 replies
SSolidJS
Created by danboyle8637 on 3/25/2023 in #support
Catching Errors from async requests started in onMount
There must be a hole in my Solid knowledge. I want to run a fetch request on component mount. This is not fetching any data so I don't want to use createResource This async request is taking state and saving it to the database. However, how do I catch any errors. When the async function throws... the error is always uncaught. Example code:
import { getTestEndpoint } from "../../utils/networkFunctions";

export const TestError = () => {
onMount(() => {
const runAsync = async () => {
await getTestEndpoint();
};

runAsync();
});

return <h1>Test Error</h1>;
};
import { getTestEndpoint } from "../../utils/networkFunctions";

export const TestError = () => {
onMount(() => {
const runAsync = async () => {
await getTestEndpoint();
};

runAsync();
});

return <h1>Test Error</h1>;
};
The test endpoint purposely returns a 500 status code which then throws an error. But I can't catch this error with an ErrorBoundary... can't catch it with try/catch What am I missing?
4 replies
CDCloudflare Developers
Created by danboyle8637 on 3/19/2023 in #pages-help
Service Bindings in Pages Local Mode
Is there a timeline when service bindings will work in pages local and not be undefined?
4 replies
CDCloudflare Developers
Created by danboyle8637 on 3/1/2023 in #workers-help
Running Service Binding Worker Locally With Pages App
I know this is a Pages "feature"... but Pages still uses Workers. And I got no response over on the Pages channel... surprised by that. I am trying to get my service binding to run locally so I can interact locally with my app. According to the docs... --service=<BINDING_NAME>=<WORKER_NAME> This is the flag to access a running Worker in dev mode. However, the wrangler in the CLI says service is an unknown argument. Further the docs say to run the Worker project with... wrangler pages dev --local This would not work for me. However, wrangler dev --local at least got my Worker running and I could talk to it directly... but never through the Worker I have in my Pages application. Are there known issues not stated in the docs about service bindings?
2 replies
CDCloudflare Developers
Created by danboyle8637 on 3/1/2023 in #pages-help
I'm trying to attach my Service Binding to my local dev command... --service not working
According to the docs, I'm running command to attach my service binding to my local dev environment: --service=<BINDING_NAME>=<WORKER_NAME> But I keep getting an error saying Unknown argument: service And in the wrangler help there is no --service command. I'm on wrangler 2.12.0. What should I try?
1 replies
CDCloudflare Developers
Created by danboyle8637 on 2/26/2023 in #pages-help
Access environment variables on the client
I'm not seeing anything in the docs about setting environment variables you can consume in client code. I see how to use binding for functions code. I set a variable in the back office GUI. How can I access that in my client code?
7 replies
CDCloudflare Developers
Created by danboyle8637 on 2/26/2023 in #pages-help
Solid Start Does Not Work With Cloudflare Pages
HTML minification is causing hydration issues with Solid Start. Solid Start uses HTML comments for hydration and CF is apparently stripping these and sites will build... but on first render errors pursue. For examples in production:
TypeError: Cannot read properties of undefined (reading 'cloneNode')
at yt (entry-client.c16bf715.js:1:18059)
at Object.fn (entry-client.c16bf715.js:1:23293)
at Ue (entry-client.c16bf715.js:1:5473)
at se (entry-client.c16bf715.js:1:5259)
at Object.it (entry-client.c16bf715.js:1:4286)
at Te (entry-client.c16bf715.js:1:9025)
at Te (entry-client.c16bf715.js:1:9022)
at Object.fn (entry-client.c16bf715.js:1:4032)
at Ue (entry-client.c16bf715.js:1:5473)
at se (entry-client.c16bf715.js:1:5259)
TypeError: Cannot read properties of undefined (reading 'cloneNode')
at yt (entry-client.c16bf715.js:1:18059)
at Object.fn (entry-client.c16bf715.js:1:23293)
at Ue (entry-client.c16bf715.js:1:5473)
at se (entry-client.c16bf715.js:1:5259)
at Object.it (entry-client.c16bf715.js:1:4286)
at Te (entry-client.c16bf715.js:1:9025)
at Te (entry-client.c16bf715.js:1:9022)
at Object.fn (entry-client.c16bf715.js:1:4032)
at Ue (entry-client.c16bf715.js:1:5473)
at se (entry-client.c16bf715.js:1:5259)
In development...
Error: Unrecoverable Hydration Mismatch. No template for key: 0-0-0-0-0-0-0-0-0-1-1-0-0-0-0-1-0-0-0-0
at getNextElement (dev.js:250:26)
at Object.fn (dev.js:590:43)
at runComputation (dev.js:708:22)
at updateComputation (dev.js:691:3)
at createMemo (dev.js:244:10)
at Dynamic (dev.js:580:10)
at Styled (index.js:79:18)
at dev.js:527:12
at untrack (dev.js:427:12)
at Object.fn (dev.js:523:37)
Error: Unrecoverable Hydration Mismatch. No template for key: 0-0-0-0-0-0-0-0-0-1-1-0-0-0-0-1-0-0-0-0
at getNextElement (dev.js:250:26)
at Object.fn (dev.js:590:43)
at runComputation (dev.js:708:22)
at updateComputation (dev.js:691:3)
at createMemo (dev.js:244:10)
at Dynamic (dev.js:580:10)
at Styled (index.js:79:18)
at dev.js:527:12
at untrack (dev.js:427:12)
at Object.fn (dev.js:523:37)
Is this a known issue? Is this on the roadmap?
3 replies