Anyone know if I can check what's been stored in caches.default somewhere?
Anyone know if I can check what's been stored in caches.default somewhere?
Error: Trace resource limit exceeded; subsequent exceptions not recorded. before?throw and that was too big (176kb lol). graphql-request errors are very big somehowwrangler dev has stopped working for me.. it just returns with no output. is there some way to debug?wrangler dev --log-level debug also gives no outputnpm create cloudflare@latest?
host option in your wrangler config: https://developers.cloudflare.com/workers/wrangler/configuration/#local-development-settingswrangler.toml configuration file to customize the development and deployment setup for your Worker project and other Developer Platform …
.wrangler directory in the project and the environment still thinking it should be there? wrangler dev again.. sometimes it just continues to return after a small delay with no output
wrangler tail working for remote urls, but it does now and its amazing. Out of curiousity, is it able to tail deployed Workers because those Workers are deployed on Cloudflare networks and therefore, Cloudflare knows when their code is executing?wrangler tail?wrangler tailwrangler tail.
.vscode/launch.json :tsconfigpackage.jsontsc directly.wrangler dev in order to run the JS file.start script)import { json } from "@remix-run/react";
export const loader: LoaderFunction = async ({ request, context, params }) => {
const url = new URL(request.url);
const cacheKey = new Request(url.toString(), request);
const cache = context.cloudflare.caches.default;
const cacheEntry = await cache.match(cacheKey);
let users = (await cacheEntry?.json())?.users;
if (!users) {
const query = url.searchParams.get("query");
const db = await context.db;
users = await db.query(query);
context.cloudflare.ctx.waitUntil(
cache.put(
cacheKey,
json(users, {
headers: {
Expires: new Date(
new Date().setFullYear(new Date().getFullYear() + 1),
).toUTCString(),
},
}),
),
);
}
...
}// So you can write this:
return json({ any: "thing" });
// Instead of this:
return new Response(JSON.stringify({ any: "thing" }), {
headers: {
"Content-Type": "application/json; charset=utf-8",
},
});.vscode/launch.jsontsconfig{
"configurations": [
{
"name": "hybrid-routing",
"type": "node",
"request": "launch",
"sourceMaps": true,
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/index.ts",
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "tsc: build - tsconfig.json",
}
]
}{
"compilerOptions": {
"types": [
"@cloudflare/workers-types",
"vitest-environment-miniflare/globals",
],
"target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"lib": ["ES2020"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"module": "NodeNext", /* Specify what module code is generated. */
"rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
"outDir": "./out", /* Specify an output folder for all emitted files. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}{
"name": "cxp-uwp2-int",
"type": "module",
"private": true,
"version": "1.0.0",
"description": "package for creating workers templates",
"main": "./index.ts",
"scripts": {
"test": "vitest --watch",
"start": "wrangler dev --local --port 3012 --env local",
"wrangler:tail": "wrangler tail",
"format": "prettier --write '**/*.{js,css,json,md}'",
"compile": "tsc"
},
"author": "{{ authors }}",
"license": "ISC",
"devDependencies": {
"@cloudflare/workers-types": "^4.20230404.0",
"@types/jest": "^29.5.0",
"@vitest/ui": "^0.29.8",
"msw": "^1.2.1",
"prettier": "^2.8.7",
"vite": "^4.5.2",
"vitest": "^0.29.8",
"vitest-environment-miniflare": "^2.13.0"
},
"dependencies": {
"itty-router": "^3.0.12",
"serverless-cloudflare-workers": "^1.2.0",
"typescript": "^5.0.3",
"wrangler": "^2.20.2"
}
}