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

    zszszsz

    04/28/2023, 10:11 PM
    Or we need to work things out by ourselves.
  • z

    zszszsz

    04/28/2023, 10:12 PM
    You just said
    RangeError: Maximum call stack size exceeded
    on deployed env, can you get more logs for that
  • z

    zszszsz

    04/28/2023, 10:13 PM
    Or maybe just wait until you can debug it locally 🙂
  • s

    spacey

    04/28/2023, 10:16 PM
    i really want this product to exist and have a great dev flow the idea is years ahead of anything else out there 🙂
  • z

    zszszsz

    04/28/2023, 10:17 PM
    That sounds to me a language issue. Maybe you want to learn more about JavaScript 🙂
  • z

    zszszsz

    04/28/2023, 10:17 PM
    It will. You can trust them on that and their . But sometimes you have to be patient.
  • s

    spacey

    04/28/2023, 10:18 PM
    i can't recreate it locally, you can't test a queue flow (send) so i'm not sure if this error is caused by the queue or the db. also to debug it i would love to have a stack trace no way to get that.
  • s

    spacey

    04/28/2023, 10:18 PM
    atleast nothing i can find in the docs
  • z

    zszszsz

    04/28/2023, 10:18 PM
    Can you
    wrangler pages deployment tail
    ?
  • s

    spacey

    04/28/2023, 10:19 PM
    yes thats now i got this error
  • z

    zszszsz

    04/28/2023, 10:20 PM
    And you
    console.log
    more and tail again ?
  • s

    spacey

    04/28/2023, 10:20 PM
    Copy code
    app.onError((e, c) => {
      console.error(`ERR2: ${e}`);
      return c.text("something wrong", 500);
    });
  • s

    spacey

    04/28/2023, 10:21 PM
    do you know a way to get a stack trace out of
    e
  • k

    kian

    04/28/2023, 10:21 PM
    e.stack
  • s

    spacey

    04/28/2023, 10:21 PM
    trying
  • l

    Lloyd

    04/28/2023, 10:21 PM
    not sure what to make of this comment, not so long ago I was working on a project to transform the typescript AST to make a project wide refactoring, and you're telling me I should learn more about javascript because I said the function docs are unclear about the lifecycle of of promises in the functions/worker framework and at what point they are resolved, thanks i guess
  • s

    spacey

    04/28/2023, 10:22 PM
    i ignored that bit not sure what else is there to learn 😂
  • z

    zszszsz

    04/28/2023, 10:23 PM
    > unclear about the lifecycle of of promises in the functions/worker framework But there is really no difference except the waitUntil part.
  • l

    Lloyd

    04/28/2023, 10:23 PM
    yeah, ok then, if you say so
  • s

    spacey

    04/28/2023, 10:23 PM
    @kian thanks that helped
    Copy code
    (error) ERR2: RangeError: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded
        at Context.notFound (functionsWorker-0.6040202837308641.js:496:7)
        at Context.notFoundHandler (functionsWorker-0.6040202837308641.js:1719:23)
        at Context.notFound (functionsWorker-0.6040202837308641.js:496:19)
        at Context.notFoundHandler (functionsWorker-0.6040202837308641.js:1719:23)
        at Context.notFound (functionsWorker-0.6040202837308641.js:496:19)
        at Context.notFoundHandler (functionsWorker-0.6040202837308641.js:1719:23)
        at Context.notFound (functionsWorker-0.6040202837308641.js:496:19)
        at Context.notFoundHandler (functionsWorker-0.6040202837308641.js:1719:23)
        at Context.notFound (functionsWorker-0.6040202837308641.js:496:19)
        at Context.notFoundHandler (functionsWorker-0.6040202837308641.js:1719:23)
  • k

    kian

    04/28/2023, 10:23 PM
    What's the full code for the Function?
  • z

    zszszsz

    04/28/2023, 10:24 PM
    Have you ever written a service worker ?
  • s

    spacey

    04/28/2023, 10:24 PM
    weird handler existsz
    Copy code
    const app = new Hono().basePath("/api");
    
    app.post("/signup", async (c) => {
    ...
    }
    export const onRequest = handle(app);
  • k

    kian

    04/28/2023, 10:24 PM
    notFoundHandler
    is just Hono - - rather than an issue with Functions
  • s

    spacey

    04/28/2023, 10:24 PM
    and i'm posting to
    /api/signup
  • s

    spacey

    04/28/2023, 10:25 PM
    thank getting the stack trace will help me solve this will work on it
  • s

    spacey

    04/28/2023, 10:25 PM
    appreciate the help
  • s

    spacey

    04/28/2023, 10:26 PM
    works in dev so 🤷‍♂️
  • k

    kian

    04/28/2023, 10:28 PM
    What's the code within
    /signup
    ?
  • s

    spacey

    04/28/2023, 10:29 PM
    Copy code
    const { firstName, email: rawEmail } = await c.req.json();
    
      if (!firstName) return error(c, "firstName missing");
      if (!rawEmail) return error(c, "email missing");
    
      const [user, host] = rawEmail.split("@");
      const email = [user.replaceAll(/(\.)|(\+.*)/g, ""), host].join("@");
    
      const { country, city, timezone } = c.req.raw.cf;
      const data = {
        email,
        firstName,
        country,
        city,
        timezone,
      };
    
    
        const db = new D1QB(c.env.DB_PROD);
        const inserted = await db.insert({
          tableName: "users",
          data,
          returning: "id",
        });
    
        await c.env.Q_SIGNUPS.send(user);
    
        return c.json({
          id: inserted.results.id,
        });
1...379380381...392Latest