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

    Walshy | Pages

    03/10/2022, 5:51 PM
    So like //pages/project/test/
  • t

    TravisFrank

    03/10/2022, 5:53 PM
    2c403e3c-c3d2-4fe4-b58a-5872d985233d
  • w

    Walshy | Pages

    03/10/2022, 5:55 PM
    Looks like you deleted the KV namespace you had originally linked
  • w

    Walshy | Pages

    03/10/2022, 5:55 PM
    > [{Code:10041 Message:No KV namespace found with ID 28eee0cb9657457797ba8458a8359e55}]
  • v

    vivekpatt_whyd

    03/10/2022, 5:56 PM
    Exactly @User
  • k

    King Mesal

    03/10/2022, 6:50 PM
    I'm not sure if I have found a bug or a feature... I created a path:
    functions/api/blog/[category]/[id].ts
    When I launch it and I request the path /api/blog/cat/123456
    Copy code
    category: cat,123456
    id: undefined
    Now, if I change the functions path to be
    [[category]]
    instead of single bracket, it works and breaks the path apart as I would hope.
  • s

    Skye

    03/10/2022, 6:52 PM
    iirc there's a bug with it parsing it incorrectly at the moment
  • s

    Skye

    03/10/2022, 6:53 PM
    It currently does it as
    /api/blog/:category]/[id
  • k

    King Mesal

    03/10/2022, 6:54 PM
    yeah, that is exactly what I saw in the generated _worker.js
  • v

    vivekpatt_whyd

    03/10/2022, 6:56 PM
    @User @User @User, Can anyone help me with this? Functions is not firing when Transform Rule rewriting is enabled.
  • m

    minimusubi

    03/10/2022, 7:05 PM
    yeah, I ran into the same issue as you :/
  • m

    minimusubi

    03/10/2022, 7:06 PM
    it seems to work as long as there aren't consecutive path parameters
  • m

    minimusubi

    03/10/2022, 7:07 PM
    I tried mentioning it here https://discord.com/channels/595317990191398933/910978223968518144/950328130629926932
  • v

    vivekpatt_whyd

    03/10/2022, 8:19 PM
    Yes @User
  • k

    King Mesal

    03/10/2022, 9:19 PM
    Any chance we can confirm there is an issue being tracked for resolution on this issue?
  • k

    King Mesal

    03/10/2022, 9:34 PM
    On a very different topic... I'm trying to figure out the correct way to import the Types from
    "@cloudflare/workers-types": "^3.4.0"
    Of course I try
    import { EventContext } from "@cloudflare/workers-types";
    I also did import type, but same error, "is not a module" Has anyone does this? am I missing something super obvious?
  • a

    Artis3n

    03/10/2022, 10:16 PM
    My POST body parameters are not showing up in the functions context... I have an
    onRequestPost()
    function set up and I'm logging the full context I receive. I don't see the POST body parameters anywhere. Shouldn't they be under
    context.request.body
    ? I POST an object containing the fields "page" and "token" and
    context.request.body
    is the object
    { locked: false }
    Any logs I can collect to help identify what is going on? POSTing like this from a Nuxt site:
    Copy code
    await $axios.$post('/api/checkToken', { page: 1, token: 'abc123' })
  • k

    kian

    03/10/2022, 10:21 PM
    iirc the post body would be
    const foo = await request.json()
  • k

    King Mesal

    03/10/2022, 11:04 PM
    well, for anyone else that cares... If your tsconfig.json has
    Copy code
    "types": [
      "@cloudflare/workers-types",
    ]
    you can reference this context as such
    context: EventContext<Event, string, any>
  • a

    Artis3n

    03/10/2022, 11:14 PM
    That’s helpful to me, thanks!
  • s

    sudo killall windows

    03/11/2022, 1:34 AM
    Is there any way to check pages function logs?
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 1:35 AM
    Not yet, planned to be released before Functions hits GA though 🙂
  • s

    sudo killall windows

    03/11/2022, 1:35 AM
    Welp now I can't tell what's going on
  • s

    sudo killall windows

    03/11/2022, 1:36 AM
    I just have an error page but no way to tell ig
  • s

    sudo killall windows

    03/11/2022, 1:38 AM
    Does miniflare have pages + pages functions support?
  • s

    sudo killall windows

    03/11/2022, 1:41 AM
    Maybe I should just use plain workers
  • j

    James

    03/11/2022, 1:41 AM
    Yeah you can use wrangler2 for that 😀
  • i

    Isaac McFadyen | YYZ01

    03/11/2022, 1:42 AM
    ^
    wrangler2
    has local-only emulation for Functions rn.
  • s

    sudo killall windows

    03/11/2022, 1:44 AM
    I just copy and pasted my worker code into a function and edited it
  • s

    sudo killall windows

    03/11/2022, 1:44 AM
    Probably messed something up 🤔
1...919293...392Latest