Aster
Aster
CDCloudflare Developers
Created by Aster on 10/29/2024 in #workers-help
How to share worker code (monorepo, npm, lib, ...) with the new wrangler types --experimental-includ
Hello! We are trying to share a DO from a library in a typescript monorepo, but I believe this issue is applicable to any code sharing process (an NPM package, a lib in a monorepo, etc). With the new command npx wrangler types --experimental-include-runtime it generates a .wrangler/types/runtime.d.ts file containing a bunch of types needed for our lib. Example: SqlStorage, DurableObjectNamespace. If I have a DO in our app, everything is good and works fine. But when I move the DO in a lib, then the question of where to get the types from arise: - The lib can be used by several workers with different compatibility date or flags - the lib doesn't have a wrangler.toml to generate the types from The code will complain that the type for SqlStorage is missing for instance. Before generating the types, we were using @cloudflare/workers-types, referenced in the library tsconfig.json, and we didn't have issues. So, what's the best practice to share TS worker code?
1 replies
CDCloudflare Developers
Created by Aster on 6/4/2024 in #general-help
Cannot delete tunnel because it has active connections | Terraform
Hello! I currently use Cloudflare tunnels to expose internal applications to the developers. Dashboards, DB GUI, etc. As our applications are running in Kubernetes, I use the Crossplane Terraform provider to deploy the tunnel using Terraform along their application helm charts. On the terraform workspace deletion, I encounter the following issue:
cannot destroy Terraform configuration: Terraform encountered an error.
Summary: error deleting tunnel config "9xx21xxa-xxxx-xxxx-xxxx-xxxxxxxxxx": Cannot delete tunnel because it has active connections. Close any cloudflareds running the tunnel, or run `cloudflared tunnel cleanup` to delete stale connections, then try to delete it again. (1022).
cannot destroy Terraform configuration: Terraform encountered an error.
Summary: error deleting tunnel config "9xx21xxa-xxxx-xxxx-xxxx-xxxxxxxxxx": Cannot delete tunnel because it has active connections. Close any cloudflareds running the tunnel, or run `cloudflared tunnel cleanup` to delete stale connections, then try to delete it again. (1022).
It appears when the cloudflared pod stopped already. (so there shouldn't be any connections left) So here is what I tried, without success: - Delete the cloudflared pod first, before cleaning up the TF workspace. - Clean up the TF workspace first, then delete the pod. - Add a lifecycle.preStop hook to my cloudflare pod, running the command cloudflared tunnel cleanup TUNNEL_NAME. I am running out of ideas...
1 replies
CDCloudflare Developers
Created by Aster on 7/23/2023 in #general-help
Cloudflare tunnel, API access to the internal application
So I have this internal app with a UI, that people can access with cloudflare HTTP tunnel, and use their email to login. We need to allow API requests against this internal app, so I created a Zero trust > Access > "Service Auth" token. I put the headers given by Cloudflare in postman, and test the request, but hit the cloudflare "Sign in ・ Cloudflare Access" HTML page. After re-reading the documentation, I find out that in Zero trust > Access > Applications, I need to add another policy to my Application: - one for the user emails with SSO login, action "allow", ending with @myorg.com (the default, for users.) - one for the API, I select the action "Service Auth", and include a rule to allow any Access service token. (the new one I added) I still cannot do a postman query and hit "Sign in ・ Cloudflare Access" HTML page. Any idea what am I missing? What I could be doing wrong?
2 replies