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

    angidis

    04/13/2023, 8:50 PM
    Hi 👋, I am a newbie about cloudflare workers. I would like to use this npm package inside a cloudflare Pages function (https://www.npmjs.com/package//google-spreadsheet?activeTab=readme). Is it possible to do it? How should I do? Thanks in advance.
  • l

    Larry

    04/14/2023, 3:17 AM
    Seems unlikely out of the box. It uses axios which uses XMLHttpRequest or the equivalent on node.js. The Pages/Worker environment uses fetch() instead. That said, you won't know until you try. There is a node compatibility mode I've seen it mentioned somewhere here on Discord that may improve your chances but I don't know anything about it.
  • z

    zszszsz

    04/14/2023, 6:07 AM
    I have a question about pricing. If I have two pages projects, one is on unbound functions and another is bundled, will I have both 1m unbound requests and 10m bundled requests in total ?
  • h

    HardAtWork

    04/14/2023, 6:08 AM
    Yes
  • z

    zszszsz

    04/14/2023, 6:09 AM
    Doesn't that sound a bit...like if I am not using unbound functions I am somehow wasting the quota
  • h

    HardAtWork

    04/14/2023, 6:17 AM
    🤷 I mean, $5 is pretty cheap for 11 million rpm, and they could always take away one or the other
  • h

    HardAtWork

    04/14/2023, 6:17 AM
    So I think it is a good deal
  • a

    angidis

    04/14/2023, 6:50 AM
    thank you
  • z

    zszszsz

    04/14/2023, 8:20 AM
    Yeah it is a good deal
  • z

    zszszsz

    04/14/2023, 6:55 PM
    Can I have middlewares in front of all functions but not static files
  • w

    Walshy | Pages

    04/14/2023, 6:55 PM
    yup
  • w

    Walshy | Pages

    04/14/2023, 6:56 PM
    exclude your static files with _routes.json
  • z

    zszszsz

    04/14/2023, 6:56 PM
    Oh I see I forget that
  • z

    zszszsz

    04/14/2023, 6:59 PM
    So I am thinking of build that _routes.json from the esbuild generated metafile.
  • s

    saarsa

    04/14/2023, 7:15 PM
    Hii stupid question how do I use and deploy model from npm in function Like Nodemailer?
  • z

    zszszsz

    04/14/2023, 7:27 PM
    Yeah that is trivial if the list is not too long, or should merge it or would there be some magic
  • z

    zszszsz

    04/14/2023, 7:28 PM
    or maybe I should just exclude: ["/static"]
  • z

    zszszsz

    04/14/2023, 7:29 PM
    Like Nodemailer
    I don't think it is possible.
  • z

    zszszsz

    04/14/2023, 7:29 PM
    Yeah you can use packages from npm if it supports the runtime I mean
  • c

    cooper | Meme Dev ☁

    04/15/2023, 11:12 AM
    can i import python libraries (the ones that have not been ported over to js) when writing in python and transpiling to js?
  • m

    micvolo

    04/15/2023, 2:35 PM
    can you send attachments with mailchannels?
  • s

    saarsa

    04/15/2023, 4:15 PM
    Ok I will check thanks
  • s

    saarsa

    04/15/2023, 4:18 PM
    I understand it doesn't work if you don't pay for the service and you must to use the emailchannels service But thanks
  • s

    silentdevnull

    04/15/2023, 8:21 PM
    Is there a file size limit that different for .wasm modules vs started files?
  • z

    zegevlier

    04/15/2023, 8:51 PM
    Functions are workers under the hood, and they share the same limits. The total generated worker should be under 5MiB (I believe)
  • z

    zegevlier

    04/15/2023, 8:51 PM
    1MiB if you're on workers free, 5MiB if you're on workers paid
  • s

    Skye

    04/15/2023, 9:27 PM
    Soon™️ 10mb, but yeah
  • s

    silentdevnull

    04/15/2023, 9:54 PM
    Thank you both. I will have to figure out something else then as my .wasm at 9mb.
  • z

    zszszsz

    04/16/2023, 12:35 AM
    While, a full mail client like nm is not supported for sure since we don't have raw sockets. Unless you have a http stream/ws to raw socket proxy
  • z

    zszszsz

    04/16/2023, 12:38 AM
    Btw is https://blog.cloudflare.com/introducing-socket-workers/ still in private beta or die ?
1...371372373...392Latest