https://discord.cloudflare.com logo
Join Discord
Powered by
# functions
  • e

    Erwin

    01/13/2022, 1:49 AM
    cough https://sleep.workers.community/greg
  • c

    Cоlе

    01/13/2022, 1:59 AM
    is there a way to verify a request has been cached using the API properly?
  • h

    HardAtWork

    01/13/2022, 2:00 AM
    Try fetching it from the cache?
  • c

    Cоlе

    01/13/2022, 2:01 AM
    😐
  • c

    Cоlе

    01/13/2022, 2:01 AM
    would there be any headers or anything?
  • c

    Cоlе

    01/13/2022, 2:01 AM
    the cf headers say no hit, but idk if that's the cached headers, or if they actually get updated
  • h

    HardAtWork

    01/13/2022, 2:03 AM
    What's the message?
  • c

    Cоlе

    01/13/2022, 2:03 AM
  • h

    HardAtWork

    01/13/2022, 2:04 AM
    Is that from a Pages site? Or a Pages Functions call?
  • c

    Cоlе

    01/13/2022, 2:04 AM
    pages functions call
  • e

    Erwin

    01/13/2022, 2:05 AM
    I don't think we add one, but you could certainly add one if the
    caches.default.match()
    call returns a response?
  • c

    Cоlе

    01/13/2022, 2:06 AM
    what would I use to check? I guess I could add an extra header or something
  • c

    Cоlе

    01/13/2022, 2:06 AM
    no logs
  • h

    HardAtWork

    01/13/2022, 2:06 AM
    If
    caches.default.match()
    returns a response, it is in the cache.
  • e

    Erwin

    01/13/2022, 2:07 AM
    Yeah.. debugging Pages Functions is very much work in progress right now
  • h

    HardAtWork

    01/13/2022, 2:07 AM
    Oh, does Functions overwrite the cache header?
  • e

    Erwin

    01/13/2022, 2:08 AM
    No, but Workers in general is a DYNAMIC request.. even if you read it from your cache, we don't know if you then change that request right?
  • c

    Cоlе

    01/13/2022, 2:08 AM
    on that note, I got image rendering done in a workers/function https://kits.aoelite.me/preview.png?MJ00Y
  • c

    Cоlе

    01/13/2022, 2:09 AM
    I ended up using upng.js and wrote a .png parser from scratch... definitely not super confusing, but it works!
  • e

    Erwin

    01/13/2022, 2:09 AM
    But right now you have an if statement in there somewhere that checks if the caches.default.match returned non-null.. and if so you return that response straight away. You can add a custom caching hit header there.
  • e

    Erwin

    01/13/2022, 2:10 AM
    I wow! I would love to see that! I have been meaning to give image rendering a go for so long..
  • c

    Cоlе

    01/13/2022, 2:10 AM
    I'll see what I can pull together
  • j

    James

    01/13/2022, 2:11 AM
    This is very cool! I’d also love to see it if you want to share
  • h

    HardAtWork

    01/13/2022, 2:11 AM
    Sniff Sniff Nodecraft Acquisition Sniff Sniff
  • c

    Cоlе

    01/13/2022, 2:12 AM
    I might have to
    [redacted]
    a few things 🤣
  • c

    Cоlе

    01/13/2022, 2:18 AM
    @User @User https://gist.github.com/Mexican-Man/3fa32fcff057bb39b44e8baed1f2529a ok lemme give a quick explanation; so most of it is pretty straightforward using
    @types/upng-js
    , but the data from the "unpkg.com" has its textures as 32x32 for some reason, so I did some super jank resizing (
    columnOffset
    , other stuff as line 44).
  • h

    HardAtWork

    01/13/2022, 2:18 AM
    How'd I never notice this...
  • c

    Cоlе

    01/13/2022, 2:19 AM
    the point of it is our online kit viewer remake (going live later this week), which uses it for embeds 😛 https://kits.aoelite.me/?MJ00Y
  • e

    Erwin

    01/13/2022, 2:23 AM
    I agree! @James, you should totally acquire @Cоlе’s side project 🤣
  • e

    Erwin

    01/13/2022, 2:29 AM
    But that looks great @User
1...575859...392Latest