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

    geelen

    03/04/2022, 6:11 PM
    you can use
    exit 0
  • g

    geelen

    03/04/2022, 6:11 PM
    it's on the docs somewhere but it's a dumb bug and we wanna fix it
  • m

    minimusubi

    03/04/2022, 6:32 PM
    i missed that in the docs! thank you
  • m

    minimusubi

    03/04/2022, 6:35 PM
    ah, this seems to be the issue (other routes removed)
    Copy code
    json
    {
      "routes": {
        "GET /api/stop/search/near/:latitude]/[longitude": {
          "module": [
            "api/stop/search/near/[latitude]/[longitude].ts:onRequestGet"
          ]
        }
      },
      "baseURL": "/"
    }
  • y

    Yāsky

    03/05/2022, 2:10 AM
    Hello everyone I've deployed a skeleton SvelteKit app to Pages. I wanted to test the functions bit, so I added a
    functions
    directory at the root level — the same level as
    src
    . On my preview app — or in local Wrangler — my root route is now no longer defined; it errors out with a 404. The only routes available are the routes from my functions. Any idea on this? I would like to have the SvelteKit app call functions from the
    functions
    folder
  • i

    Isaac McFadyen | YYZ01

    03/05/2022, 2:14 AM
    SvelteKit doesn't work with
    functions
    since it uses them internally (meaning if you try to create functions it overrides theirs).
  • i

    Isaac McFadyen | YYZ01

    03/05/2022, 2:14 AM
    I'd instead point you towards either: - SvelteKit Endpoints (anything you can do in Functions you can do in Endpoints) - or
    @sveltejs/adapter-static
    and
    /functions
    .
  • y

    Yāsky

    03/05/2022, 2:15 AM
    Right, I see. Cos reading through the Functions docs, it looked similar to what's possible with SvelteKit. Thanks for clarifying
  • k

    Kynson

    03/06/2022, 9:03 AM
    Hi, I would like to know if we could blind secret variables to function in production in the mean time?
  • m

    minimusubi

    03/06/2022, 1:01 PM
    Are you talking about environment variables?
  • k

    Kynson

    03/06/2022, 1:02 PM
    I meant the “encrypted” environment variables (like the one available on workers)
  • k

    KES

    03/06/2022, 2:12 PM
    I'm working locally with wrangler@beta. Have set up my first pages project with functions. Have created a simple path to a users dir which contains an index.js. Calling fetch on the response of that route returns my index.html content. Not the response of the function
  • k

    KES

    03/06/2022, 2:12 PM
    I imagine I have something seriously wrong in my concept of how this works?
  • k

    KES

    03/06/2022, 2:13 PM
    No frameworks. Just an index.html that calls a index.js with one simple fetch get request.
  • k

    KES

    03/06/2022, 2:13 PM
    Error in catch is
    Copy code
    SyntaxError: Unexpected token < in JSON at position 0
  • k

    KES

    03/06/2022, 2:14 PM
    That response is actually just the current page returned.
  • m

    minimusubi

    03/06/2022, 2:48 PM
    Are all web requests made through
    fetch
    forced to use HTTPS? I have a strange issue where I appear to receive the response from the
    https
    URL instead of the
    http
    one, even though my fetch request starts with
    http://
  • k

    KES

    03/06/2022, 2:53 PM
    I found my issue. And just a total too late in the day thing. I had my route in the wrong folder...
  • k

    KES

    03/06/2022, 2:53 PM
    Thanks for chiming in though. I had also been wondering about how that situation might be handled.
  • i

    Isaac McFadyen | YYZ01

    03/06/2022, 2:54 PM
    Not currently, it's planned for once Functions are out of beta.
  • p

    Plotzes

    03/06/2022, 6:40 PM
    Are the limits like CPU time or duration the same for functions as for normal workers?
  • i

    Isaac McFadyen | YYZ01

    03/06/2022, 6:46 PM
    For now I believe they correspond to the Bundled Workers plan (50ms), but that may change once Functions are GA.
  • p

    Plotzes

    03/06/2022, 7:03 PM
    Ah ok, thank you!
  • k

    Kynson

    03/07/2022, 1:29 AM
    I see thanks
  • j

    justinhook

    03/07/2022, 2:45 AM
    is it possible that firebase's "functions" directory conflicts with cloudflare's? is it possible to change what the directory is called?
  • h

    HardAtWork

    03/07/2022, 3:34 AM
    Yeah it looks like those do conflict, so I guess you would have to break it into two separate repos
  • j

    justinhook

    03/07/2022, 3:46 AM
    hmm yeah maybe. i don't use cloudflare functions because of the subrequest limit, but i always have an error that im over my functions request limit. wonder what if cf is trying to do something with my firebase functions.
  • e

    Erwin

    03/07/2022, 4:06 AM
    Yup.. they are probably trying to package those up and run them?
  • m

    minimusubi

    03/07/2022, 4:09 AM
    I believe you can configure what Firebase's functions directory is called
  • j

    justinhook

    03/07/2022, 4:25 AM
    looks like you can - will report back tomorrow if this solves functions exceeding their limit
1...899091...392Latest