Conversation
LCOV of commit
|
| // check if shared token is configured and validate | ||
| if (env.COLLAB_SHARED_SECRET) { | ||
| if (request.headers.get('authorization') !== `token ${env.COLLAB_SHARED_SECRET}`) { | ||
| return new Response('Unauthorized', { status: 401 }); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
| // same signature as the global `fetch()` function, but the request is always sent to the | ||
| // object, regardless of the hostname in the request's URL. | ||
| return roomObject.fetch(req); | ||
| return await roomObject.fetch(req); |
There was a problem hiding this comment.
without this, the catch below is never cought if the error is thrown async.
| destroy() { | ||
| super.destroy(); | ||
| this.awareness.destroy(); | ||
| } |
There was a problem hiding this comment.
ensure that the awareness is destroyed, too. this stops the internal timer and allows the process to stop
| const apiUrl = new URL(doc); | ||
| apiUrl.searchParams.set('api', api); | ||
| return roomObject.fetch(new Request(apiUrl)); |
There was a problem hiding this comment.
not sure why this worked. but the fetch() api expects a Request (tested on stage as well)
There was a problem hiding this comment.
According to this doc https://developers.cloudflare.com/workers/runtime-apis/fetch/ it expects either: URL, string or Request.
There was a problem hiding this comment.
I think they messed this up... fetch(url, init) is used for making requests, but the fetch(request, env, ctx) handler has a different signature. they should have named this differently.
| // `controller.storage` provides access to our durable storage. It provides a simple KV | ||
| // get()/put() interface. | ||
| this.storage = controller.storage; | ||
| this.storage = controller?.storage; |
There was a problem hiding this comment.
if the controller is optional below, it should be here, too
| // clear event handlers | ||
| doc.destroy(); |
There was a problem hiding this comment.
ensure that eventhandlers and timers are removed when doc is removed from cache
karlpauls
left a comment
There was a problem hiding this comment.
looks great - I had noticed the missing await for the error as well (but forgot about it). Nice!
# 1.0.0 (2025-12-08) ### Bug Fixes * add check for shared secret ([#108](#108)) ([a79731f](a79731f)) * add span to known HTML tags ([#101](#101)) ([fbf016d](fbf016d)) * do not empty document if error ([#90](#90)) ([a406add](a406add)) * encode HTML brackets ([#100](#100)) ([6c5b5fd](6c5b5fd)) * encode HTML brackets ([#74](#74)) ([015163e](015163e)) * keep content if no main found in html ([#85](#85)) ([9fd25ac](9fd25ac)) * null doc crashes aem2doc ([#84](#84)) ([6197114](6197114)) * ommit stacktraces in error map for non-dev ([#110](#110)) ([1f896ac](1f896ac)) * remove html comments ([#68](#68)) ([cf05aae](cf05aae)) ### Features * disable stack traces on production ([#109](#109)) ([79c40bd](79c40bd)) * Prevent implicit document creation via If-Match header ([#105](#105)) ([b33ae65](b33ae65))
# 1.0.0 (2025-12-08) ### Bug Fixes * add check for shared secret ([#108](#108)) ([a79731f](a79731f)) * add span to known HTML tags ([#101](#101)) ([fbf016d](fbf016d)) * do not empty document if error ([#90](#90)) ([a406add](a406add)) * encode HTML brackets ([#100](#100)) ([6c5b5fd](6c5b5fd)) * encode HTML brackets ([#74](#74)) ([015163e](015163e)) * keep content if no main found in html ([#85](#85)) ([9fd25ac](9fd25ac)) * null doc crashes aem2doc ([#84](#84)) ([6197114](6197114)) * ommit stacktraces in error map for non-dev ([#110](#110)) ([1f896ac](1f896ac)) * remove html comments ([#68](#68)) ([cf05aae](cf05aae)) * trigger release ([ca061d4](ca061d4)) ### Features * disable stack traces on production ([#109](#109)) ([79c40bd](79c40bd)) * Prevent implicit document creation via If-Match header ([#105](#105)) ([b33ae65](b33ae65))
see https://jira.corp.adobe.com/browse/SITES-33249
invoke(this doesn't work w/o RPC...)DocRoom.handleApiCall()directly from edge functions in order to avoid extra routing via urlSharedDocis destroyed when failed to initialize, in order to avoid hanging timers of the awareness handlernote: when running in the IDE, I still have the tests hanging... I found some of the leaks, but I assume there are still more. I assume those might cause unhandled promise rejections down the road or prevent the workers from being discarded? maybe?