I have a problem with the implementation of my site I need helped
I have a problem with the implementation of my site I need helped
dev, the process oftentimes doesn't shut down correctly and it ends up needing to use a different port every time.✘ [ERROR] Address already in use (127.0.0.1:60392). Please check that you are not already running a server on this address or specify a different port with --port.wrangler.toml, but need to duplicate my D1 schema in both and I think they would have different local DBs when running locally. (program) as the profiled code and it runs for the whole duration so it's not very usefulchrome://inspect and connecting using the new Performance tab (though i had to pass the --inspect flag to wrangler to make it connect properly)create-cloudflare) with wrangler locally (not sure why it thinks the address in use - it's not)
dev
wrangler dev
WorkerKV for some experiment and this is my codeexpiration props again?this.windowMs = 60_000 // 1 minute✘ [ERROR] Address already in use (127.0.0.1:60392). Please check that you are not already running a server on this address or specify a different port with --port.project
- pages_dir
- src/
...
- worker1
...
- wranger.toml(program)(program)chrome://inspectcreate-cloudflare ⛅️ wrangler 3.62.0
-------------------
✨ Compiled Worker successfully
✘ [ERROR] Address already in use (127.0.0.1:8788). Please check that you are not already running a server on this address or specify a different port with --port.
[wrangler:inf] Ready on http://localhost:53635
⎔ Starting local server...
/Users/ccostes/dev/onecall-cloudflare/frontend/node_modules/wrangler/wrangler-dist/cli.js:29747
throw a;
^
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (/Users/ccostes/dev/onecall-cloudflare/frontend/node_modules/miniflare/dist/src/index.js:9161:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Mutex.runWith (/Users/ccostes/dev/onecall-cloudflare/frontend/node_modules/miniflare/dist/src/index.js:3521:16) {
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}
Node.js v21.5.0WorkerKVexpirationthis.windowMs = 60_000 // 1 minutelsof -i :60392
kill -9 <PID>await this.namespace.put(keyWithPrefix, JSON.stringify(payload), {
expiration: Math.floor(payload.resetTime.getTime() / 1000),
});async increment(key: string): Promise<ClientRateLimitInfo> {
const keyWithPrefix = this.prefixKey(key);
// @ts-ignore
let payload: Required<ClientRateLimitInfo> = await this.namespace.get<Required<ClientRateLimitInfo>>(
keyWithPrefix,
"json",
);
const wasCreated = payload != null
if (wasCreated) payload = {
totalHits: payload.totalHits + 1,
resetTime: new Date(payload.resetTime),
};
else
payload = {
totalHits: 1,
resetTime: new Date(Date.now() + this.windowMs),
};
console.log("Payload - ", payload, " Expire - ", payload.resetTime.toLocaleString(), " Current - ", new Date().toLocaleString())
await this.namespace.put(keyWithPrefix, JSON.stringify(payload), {
expiration: !wasCreated ? Math.floor(payload.resetTime.getTime() / 1000) : undefined,
// expirationTtl: this.windowMs
});
return payload;
}