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

    Isaac McFadyen | YYZ01

    03/20/2022, 2:41 PM
    Yeah, Sendgrid works with Functions but not the SDK, you just need to run a
    fetch
    on the REST API.
  • p

    portalBlock | Ping on Reply

    03/20/2022, 4:01 PM
    Ohhh that makes sense! Thank you!!
  • p

    portalBlock | Ping on Reply

    03/20/2022, 4:01 PM
    Good to know it can be done 😄
  • p

    portalBlock | Ping on Reply

    03/20/2022, 10:19 PM
    Where can I check for errors from a Function? I'm hitting an
    /api/contact
    and the site is returning an error 500 and says to login to check
  • w

    Walshy | Pages

    03/20/2022, 10:22 PM
    Best way to go about it is have an error catcher middleware. You can also test locally with wrangler2 or setup error logging with something like Sentry
  • p

    portalBlock | Ping on Reply

    03/20/2022, 10:23 PM
    Alright, thanks!
  • p

    portalBlock | Ping on Reply

    03/20/2022, 10:42 PM
    Should middleware be reflected in the config section? I added an error handler in but get the same CF rendered error page with no stack details, like the middleware should be putting in.
  • i

    IncasedName

    03/20/2022, 10:43 PM
    Yeah it should be good
  • p

    portalBlock | Ping on Reply

    03/20/2022, 10:43 PM
    Ok so it doesn't list middleware?
  • i

    IncasedName

    03/20/2022, 10:44 PM
    Oh I see what you mean now
  • s

    simpson

    03/21/2022, 12:03 PM
    Has anyone here used functions to SSR nextjs pages? Also, it looks like a few have mentioned Svelte works well with static and SSR pages, does anyone have any sample repos?
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:08 PM
    ?pages-functions-frameworks
  • h

    Helpflare

    03/21/2022, 12:08 PM
    Currently supported frameworks for SSR on Pages Functions include: - SvelteKit - Remix - Nuxt Other frameworks may be supported by statically building files for normal Pages. If you have a framework working using SSR on Functions that is not listed here, let us know and we'll add it.
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:09 PM
    ^ Next.JS is not yet supported for SSR, only for static rendering.
  • s

    simpson

    03/21/2022, 12:09 PM
    do you think it ever will be?
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:09 PM
    Yeah, likely. Next.JS is working on becoming framework-agnostic for deployments (I think there's a GitHub Issue open about it that's being worked on)
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:10 PM
    But it's not currently AFAIK.
  • s

    simpson

    03/21/2022, 12:14 PM
    ahh ok, good to know. Thanks!
  • s

    simpson

    03/21/2022, 12:14 PM
    must be this one https://github.com/vercel/next.js/issues/31506
  • s

    Stigin

    03/21/2022, 12:15 PM
    Hi all - I just realised I was pasting in the wrong worker section where Kian was graciously helping! Bit late here but i'm trying to deploy a function through pages with sveltekit I get a NODE_VERSION warning despite an env build variable on Cloudflare set to "NODE_VERSION | 16.14.2" - I have tried typing this manually as i'm aware there is a C&P bug.
    Copy code
    + @cloudflare/wrangler@1.19.9
    added 22 packages from 9 contributors in 2.615s
    npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
    npm ERR! code ENOTSUP
    npm ERR! notsup Unsupported engine for @sveltejs/kit@1.0.0-next.301: wanted: {"node":">=14.13"} (current: {"node":"12.22.10","npm":"6.14.16"})
    npm ERR! notsup Not compatible with your version of node/npm: @sveltejs/kit@1.0.0-next.301
    npm ERR! notsup Not compatible with your version of node/npm: @sveltejs/kit@1.0.0-next.301
    npm ERR! notsup Required: {"node":">=14.13"}
    npm ERR! notsup Actual:   {"npm":"6.14.16","node":"12.22.10"}
    Any suggestions? Feels like i'm missing something very basic. I generated a wrangler.toml file in the root directory as it was previously complaining it couldn't find it.
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:15 PM
    Hmm... Try setting to a less specfic version, for example:
    NODE_VERSION: 16
    which will install the latest major 16 version.
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:15 PM
    That's the only thing I can think of.
  • s

    Stigin

    03/21/2022, 12:17 PM
    Let me give that a try thanks Isaac.
  • k

    kian

    03/21/2022, 12:18 PM
    16.14.2
    only released ~4 days ago - not sure where the build process pulls versions from but might not be ready (or supported) on that platform I guess
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:22 PM
    It pulls from NVM but I'm not sure what version of NVM etc.
  • s

    Stigin

    03/21/2022, 12:23 PM
    Yep so this fixed the problem.
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:23 PM
    Great! 👍
  • s

    Stigin

    03/21/2022, 12:23 PM
    Cheers!
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:23 PM
    I'll add it to our node-version tag.
  • i

    Isaac McFadyen | YYZ01

    03/21/2022, 12:25 PM
    Tada!
1...105106107...392Latest