https://discord.cloudflare.com logo
Join DiscordCommunities
Powered by
# functions
  • z

    zszszsz

    04/28/2023, 10:30 PM
    I still cannot see a reason why
    Context.notFound
    and
    Context.notFoundHandler
    would call each other. Is it really a hono thing ?
  • s

    spacey

    04/28/2023, 10:31 PM
    its based of the cloudflare example on the hono site https://hono.dev/getting-started/cloudflare-pages#_2-hello-world
  • z

    zszszsz

    04/28/2023, 10:31 PM
    https://github.com/honojs/hono/blob/ac7eeda87f8b71843815258edf8db159c306bd2e/src/context.ts#L337
  • z

    zszszsz

    04/28/2023, 10:31 PM
    What is this https://github.com/honojs/hono/blob/ac7eeda87f8b71843815258edf8db159c306bd2e/src/context.ts#L100
  • z

    zszszsz

    04/28/2023, 10:32 PM
    I want to see how you created the hono app
  • z

    zszszsz

    04/28/2023, 10:33 PM
    or, the "options"
  • s

    spacey

    04/28/2023, 10:33 PM
    exactly like their example said
    Copy code
    import { Hono } from 'hono'
    import { handle } from 'hono/cloudflare-pages'
    
    const app = new Hono().basePath('/api')
    
    app.get('/hello', (c) => {
      return c.json({
        message: 'Hello, Cloudflare Pages!',
      })
    })
    
    export const onRequest = handle(app)
  • s

    spacey

    04/28/2023, 10:34 PM
    hmm i see the example on the cloudflare site is different
    Copy code
    import { Hono } from "hono";
    const app = new Hono();
    
    app.get("/", (ctx) => ctx.text("Hello world, this is Hono!!"));
    
    export default app;
  • s

    spacey

    04/28/2023, 10:34 PM
    it does not use hono/cloudflare-pages
  • z

    zszszsz

    04/28/2023, 10:36 PM
    Say we need to find that problematic
    notFoundHandler
    if there is one.
  • z

    zszszsz

    04/28/2023, 10:37 PM
    Do you have a notFound(sth) call
  • s

    spacey

    04/28/2023, 10:37 PM
    got it
  • s

    spacey

    04/28/2023, 10:37 PM
    i had a
    app.notFound((c) => c.notFound());
    it should be
    app.notFound((c) => c.text("not found", 404));
  • z

    zszszsz

    04/28/2023, 10:38 PM
    nice catch
  • z

    zszszsz

    04/28/2023, 10:40 PM
    It is
  • z

    zszszsz

    04/28/2023, 10:40 PM
    https://github.com/honojs/hono/blob/c0af3d07268c29b667fd41ff8f137ad1142fd620/src/hono.ts#L181
  • s

    spacey

    04/28/2023, 10:40 PM
    i like this edge work flow enough to figure this all out and will write a detailed how-to from dev to prod with pages+d1+queue
  • z

    zszszsz

    04/28/2023, 10:40 PM
    It is rocket science whether you like it or not.
  • s

    spacey

    04/28/2023, 10:41 PM
    i see the issue in the logs now
    Copy code
    GET https://42papers.com/api/signup - Ok @ 4/28/2023, 3:37:11 p.m.
    GET https://42papers.com/api/signup - Ok @ 4/28/2023, 3:38:17 p.m.
    PUT https://42papers.com/api/signup - Ok @ 4/28/2023, 3:39:01 p.m.
    GET https://42papers.com/api/signup - Ok @ 4/28/2023, 3:40:54 p.m.
  • s

    spacey

    04/28/2023, 10:41 PM
    some reason my post requests are turning into
    get
    .
    'put
    seems to be fine though
  • z

    zszszsz

    04/28/2023, 10:43 PM
    Browser side thing ?
  • s

    spacey

    04/28/2023, 10:43 PM
    hmm getting a 301 back for some reason
    Copy code
    > POST /api/signup HTTP/1.1
    > Host: mywebsite.com
    > User-Agent: insomnia/2022.7.5
    > Content-Type: application/json
    > Accept: */*
    > Content-Length: 57
    
    | {
    |    "firstName": "blah",
    |      "email": "blah@gmail.com"
    | }
    
    * Mark bundle as not supporting multiuse
    
    < HTTP/1.1 301 Moved Permanently
    < Date: Fri, 28 Apr 2023 22:40:54 GMT
    < Transfer-Encoding: chunked
    < Connection: keep-alive
    < Cache-Control: max-age=3600
    < Expires: Fri, 28 Apr 2023 23:40:54 GMT
    < Location: https://mywebsite.com/api/signup
  • z

    zszszsz

    04/28/2023, 10:44 PM
    I would never use a 301 for post. I don't believe if it is hono.
  • s

    spacey

    04/28/2023, 10:45 PM
    i need to step away will dig in more later today. thanks for all the help on here really appreciate it
  • z

    zszszsz

    04/28/2023, 10:46 PM
    I would bet on it is yourself again 🙂
  • s

    Skye

    04/28/2023, 11:04 PM
    Are you connecting with http by any chance? You're probably just getting the normal http->https redirect
  • z

    zszszsz

    04/28/2023, 11:05 PM
    But shouldn't it still be a 307 if it is POST ?
  • s

    Skye

    04/28/2023, 11:11 PM
    I believe there's an option for it, but it's not the default
  • z

    zszszsz

    04/28/2023, 11:13 PM
    I want a cf console mobile app to monitor pages builds
  • s

    spacey

    04/29/2023, 2:57 AM
    that was it thanks
1...380381382...392Latest