Created a brand new most basic worker and it works as expected. It must be some other incompatibilit
Created a brand new most basic worker and it works as expected. It must be some other incompatibility in my react-router-7 + vite setup then.
process.env when running client side. What I noticed now is that I can access process.env vars in react-router loaders that run server-side, but those vars are not defined on process.env for client-side code, even when prepended with VITE_PUBLIC_.@cloudflare/vite-plugin working and running up against a bit of a wall when starting the app (with RRv7). I'm getting a "AssertionError: depsOptimizer is required in dev mode" | [plugin:vite:import-analysis] depsOptimizer is required in dev mode error, which appears to come up when the source is a node module? I extended the the assertion for the source that's failing and it looks like its AssertionError: depsOptimizer is required in dev mode for node:crypto. pages npm package and why would you need it? That’s over a decade old and for AngularJS and almost certainly won’t work in Workers pages from npm. npx wrangler pages dev for example will run a local dev server for Cloudflare Pageswrangler d1 execute --help I see the option for -y. Is there the opposite? -n? I need to have the .sql file for D1 be created (to get its name) by running wrangler d1 execute id-development -e development --command ' ' --local which will result in an error and I don't think spamming Cloudflare with random stuff is something I should doWould you like to report this error to Cloudflare? Wrangler's output and the error details will be shared with the Wrangler team to help us diagnose and fix the issue. (Y/n), and using -y would say yes every time, also | yes n is not an optionwrangler types in monorepo packages? I have multiple workers that can bind to one another (as well as DOs) but I'm not sure how to get a typed reference to workers/my-agent from apps/api without apps/api importing from workers (which I don't want)
wrangler dev like the one below? not sure if it's a vite issue (i'm migrating from remix's classic compiler) but the vite build itself completes successfully (remix vite:build). i'm just not sure where to begin. to my knowledge, server.js is not a file that has been generated by my buildDurableObjectNamespace<import('where your DO class is exported').exportname> or Service<same import for service bindingsRecipeParser works fine, i'm struggling with DO declarations though, like that namespace doesn't actually work (it doesnt' give errors, but test() doesn't appear on the type when consuming it"types": ["@cloudflare/workers-types"]wrangler typesVITE_PUBLIC_@cloudflare/vite-plugin"AssertionError: depsOptimizer is required in dev mode"[plugin:vite:import-analysis] depsOptimizer is required in dev modeAssertionError: depsOptimizer is required in dev mode for node:cryptonpx wrangler pages devwrangler d1 execute --help-y-y-n.sqlwrangler d1 execute id-development -e development --command ' ' --localWould you like to report this error to Cloudflare? Wrangler's output and the error details will be shared with the Wrangler team to help us diagnose and fix the issue. (Y/n)| yes nwrangler typeswrangler typesworkers/my-agentapps/apiapps/apiworkersremix vite:build⎔ Starting local server...
✘ [ERROR] service core:user:discohook-site: Uncaught TypeError: d7t is not a function
at null.<anonymous> (server.js:452:17894)DurableObjectNamespace<import('where your DO class is exported').exportname>Service<same importRecipeParsertest()"types": ["@cloudflare/workers-types"] type RecipeAgent = Rpc.DurableObjectBranded & {
test: () => Promise<void>;
};declare global {
namespace Dependencies {
type RecipeParser = Service<RecipeParserWorker>;
interface RecipeParserWorker extends WorkerEntrypoint<unknown> {
/**
* Main entry point that handles recipe parsing requests
*/
fetch(request: Request): Promise<Response>;
parseRecipeFromUrl(recipeUrl: string): Promise<Response>;
modifyRecipe(input: { recipe: RecipeSchema; instructions: string }): Promise<Response>;
/**
* Parse recipe using a two-phase approach:
* 1. Try fetch first (faster, less resource intensive)
* 2. Fall back to puppeteer if fetch doesn't yield good results
*/
}
class RecipeAgent extends DurableObject<unknown> {
test: () => Promise<void>;
}
type RecipeAgentNamespace = DurableObjectNamespace<RecipeAgent>;
}
}import type { DurableObject } from 'cloudflare:workers';
declare global {
namespace Dependencies {
interface RecipeAgent extends DurableObject<unknown> {
test: () => Promise<void>;
}
type RecipeAgentNamespace = DurableObjectNamespace<RecipeAgent>;
}
}