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

    HardAtWork

    04/13/2022, 3:48 AM
    While this isn't directly possible using only Workers, it is definitely possible if you use something like https://sendgrid.com/
  • z

    Zeraph

    04/13/2022, 3:54 AM
    Is it possible to install any type of libraries when using functions?
  • z

    Zeraph

    04/13/2022, 3:55 AM
    I would imagine it is NodeJS under the hood. And there are multiple ways to send emails in NodeJS
  • z

    Zeraph

    04/13/2022, 3:56 AM
    e.g.
    nodemailer
  • h

    HardAtWork

    04/13/2022, 3:56 AM
    Functions are "functionally" Workers on top of Pages. So, if you can use it on Workers, it should work with Functions.
  • h

    HardAtWork

    04/13/2022, 3:58 AM
    So
    nodemailer
    would not work, or at least not without serious tooling/shimming/feature loss.
  • e

    Evаn

    04/13/2022, 4:09 AM
    Functions/Workers isn't NodeJS under the hood-- they're a special kind of V8 service worker. This gives them excellent performance at the cost of incompatibility with libraries that expect a node environment.
  • e

    Evаn

    04/13/2022, 4:09 AM
    My app sends email by making a
    fetch
    POST request to the Mailgun API
  • i

    Isaac McFadyen | YYZ01

    04/13/2022, 12:09 PM
    Yeah, it's not Node.JS as Toggle says. Also they don't proxy TCP, only HTTP, so you need to use an HTTP email API like Sendgrid or Mailgun or similar.
  • s

    Steved

    04/13/2022, 3:18 PM
    Are websockets supported in pages functions ? Essentially I'd like to connect through to a Durable Object via the function's worker. Despite quite a bit of searching I've not seen any mention or examples. My assumption is that I'd need to modify the _workers.js. Obiously I could connect to a worker on a separate domain that connects through to the DO but having it all in one place in the pages app would be sweet.
  • i

    Isaac McFadyen | YYZ01

    04/13/2022, 3:20 PM
    So WebSocketsw are supported in Workers yeah, but I'm not sure about Functions because they are currently running an older version of the Workers runtime.
  • i

    Isaac McFadyen | YYZ01

    04/13/2022, 3:21 PM
    (And there's no way to upgrade, yet)
  • s

    Steved

    04/13/2022, 3:31 PM
    Ah, ok. thx. I may give it a go to see if I can upgrade the connection, but I'll assume it needs to be separate. I guess that custom routes for workers can't be overlaid over the pages domain either.
  • s

    sovereignChai

    04/13/2022, 5:31 PM
    Hi
  • s

    sovereignChai

    04/13/2022, 5:31 PM
    My cloudflare pages function in advanced mode
  • s

    sovereignChai

    04/13/2022, 5:31 PM
    works under miniflare
  • s

    sovereignChai

    04/13/2022, 5:31 PM
    but gives 500 error code when deployed
  • s

    sovereignChai

    04/13/2022, 5:31 PM
    I tried putting it in a global try catch function
  • s

    sovereignChai

    04/13/2022, 5:31 PM
    And returning the error in the body
  • s

    sovereignChai

    04/13/2022, 5:32 PM
    but it is not working
  • s

    sovereignChai

    04/13/2022, 5:32 PM
    What should I do to debug this issue?
  • s

    sovereignChai

    04/13/2022, 5:34 PM
    Here is the code: https://www.pastery.net/ykvhsx/
  • s

    sovereignChai

    04/13/2022, 5:34 PM
    It's a simple SSR + static assets handler
  • s

    sovereignChai

    04/13/2022, 9:40 PM
    Any suggestions anyone?
  • s

    sovereignChai

    04/13/2022, 9:41 PM
    Short of opening a CF support request, I have ran out of ideas on how to debug this
  • s

    sovereignChai

    04/13/2022, 9:41 PM
    Because CloudFlare doesn't provide logs for functions
  • s

    sovereignChai

    04/13/2022, 9:53 PM
    @Isaac McFadyen | YYZ01 🙏
  • i

    Isaac McFadyen | YYZ01

    04/13/2022, 9:54 PM
    I'm not sure it's .ts compiled when you use a
    _worker.js
  • s

    sovereignChai

    04/13/2022, 9:54 PM
    Ah sorry, i have a separate build script
  • s

    sovereignChai

    04/13/2022, 9:55 PM
    Lemme post the repo
1...118119120...392Latest