Closed whoabuddy closed 5 months ago
I’m going to close this issue for now. Going forward, we’ll revisit the assets system as part of Pages/Workers convergence, and will inherit the benefits of the Pages assets system.
In the meantime, Pages is the best choice for deploying sites with static assets. If you're still running into problems feel free to comment with a reproduction and we can investigate further.
We have a simple API setup from the TS worker template with itty-router, and up until now it's been working great.
I went to update some packages/dependencies today, and am now unable to complete a build due a type error with
getAssetFromKV
:The documentation in this repository shows the exact same format we're using for handling the event.
https://github.com/citycoins/api/blob/fed3fa78d583e290a09306631c82664eca61e339/src/index.ts#L4-L12
If the URL matches an allowed file extension in the root path, then it tries to return that file instead of sending requests to the router. One example from the working deployment before changes is openapi.yml used to generate the documentation page.
https://github.com/citycoins/api/blob/fed3fa78d583e290a09306631c82664eca61e339/src/index.ts#L29-L43
Since
addEventListener
produces aFetchEvent
by default, what is the best approach to pass the correct values togetAssetFromKV
? I saw an approach in cloudflare/workers-sdk#4973 that may work, but couldn't find a spot in the docs that made me confident this was the best way to move forward.Adding to this I reverted the commit locally and tested to be sure - can confirm it compiles with no errors and works as expected.
The packages that were updated as part of the breaking change were: