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

    silentdevnull

    03/29/2023, 6:33 PM
    The next step for me on this projector is to see if I can get my existing C# classes to go to wasm so I don't have to write them.
  • j

    JustinNoel

    03/29/2023, 8:48 PM
    Also be sure to notice that there are different environment variable settings for production in preview. So depending on if you're testing your work or not you may need to put the environment variable in both places
  • s

    silentdevnull

    03/30/2023, 5:08 AM
    With page function when you use onResquestPost what is the correct way to get the information from context? I have tried a few different page function / worker examples and I keep getting undefined for the result.
  • h

    HardAtWork

    03/30/2023, 6:07 AM
    What are you trying to extract from the context?
  • s

    silentdevnull

    03/30/2023, 6:34 AM
    I have 4 values I’m sending to the function. Im sending everything as json
  • h

    HardAtWork

    03/30/2023, 6:36 AM
    Copy code
    ts
    const values = await ctx.request.json();
  • z

    zsmooth

    03/30/2023, 8:24 PM
    I'm deploying a remix app with wrangler, and it was working a few minutes ago but now they're all failing (not on the CLI, but on the dashboard they say "deployment failed"). Anyone know what's happening? One example failed deployment: https://5e0f5547.chattest.pages.dev
  • z

    zsmooth

    03/30/2023, 8:33 PM
    never mind... deploying via git and i get the "script startup exceeded limit"
  • s

    silentdevnull

    03/31/2023, 12:01 AM
    Thank you that did the trick
  • l

    lookie02

    03/31/2023, 7:42 AM
    Hi which plan is suitable for building next js application ?
  • h

    HardAtWork

    03/31/2023, 7:43 AM
    Free should work fine. Though depending on the number of request you expect, you may want to add Workers Paid.
  • l

    lookie02

    03/31/2023, 7:48 AM
    Its just that the pages are not being built due to the longer duration time for the functions to be uploaded. So wanted to get more build time for next js
  • h

    HardAtWork

    03/31/2023, 7:49 AM
    I don't think any tier gets your more time per build, though 30 minutes should be enough for most projects. Are you erroring out, or is it taking more than 30 minutes to build/deploy?
  • l

    lookie02

    03/31/2023, 7:50 AM
    let me provide with the error that I am facing.
  • l

    lookie02

    03/31/2023, 7:51 AM
    if its possible , I want to migrate all the next js projects to cloudflare
  • l

    lookie02

    03/31/2023, 7:52 AM
    Error: Failed to publish your Function. Got error: Error: Script startup exceeded CPU time limit.
  • l

    lookie02

    03/31/2023, 7:52 AM
    this was the issue at the end of deployment
  • w

    Walshy | Pages

    03/31/2023, 7:52 AM
    Plans cannot change script startup time. You will need to move stuff out of the global scope
  • l

    lookie02

    03/31/2023, 7:54 AM
    how can i do so ? I am a devops engineer so I should advise the dev team to do accordingly
  • c

    Cayter

    03/31/2023, 2:07 PM
    got a question from this doc > A Worker can be up to 5 MB in size after compression, and up to 1 MB for free accounts. You can request adjustments to limits that conflict with your project goals by contacting Cloudflare. To increase a limit, complete the Limit Increase Request Form. does this mean that wrangler will bundle all the .ts/.js files in
    functions
    folder and this bundled file will have a 5MB file size limit (gzipped)? or wrangler doesn't really bundle all the .ts/.js files into 1, and it's 1 .ts/.js file having a limit of 5MB file size?
  • w

    Walshy | Pages

    03/31/2023, 2:08 PM
    > does this mean that wrangler will bundle all the .ts/.js files in functions folder and this bundled file will have a 5MB file size limit (gzipped)? yes
  • c

    Cayter

    03/31/2023, 2:22 PM
    thx
  • m

    MagnusG87

    03/31/2023, 4:10 PM
    Hopefully a quick question... is it possible to have a "staging" set of environment variables for pages functions? In the dashboard we only have access to "production" and "preview" sets. Ideally we would like to have a staging set as well. For context, we have a custom build process for our pages in a github action and then deploy using wranger (cloudflare/pages-action).
  • u

    Unsmart | Tech debt

    03/31/2023, 4:11 PM
    preview is staging pretty much
  • m

    MagnusG87

    03/31/2023, 4:13 PM
    We are actually currently using that as a "development" preview so in order to keep both, we would need an additional set.
  • l

    Larry

    04/02/2023, 7:56 PM
    Do you need those environment variables to populate connections to external services or for some other reason?
  • j

    Jc

    04/03/2023, 5:31 PM
    is it possible to add a function that is only executed for preview builds?
  • u

    Unsmart | Tech debt

    04/03/2023, 5:32 PM
    what are you trying to do that you only want on preview and not production?
  • j

    Jc

    04/03/2023, 5:34 PM
    set a CORS header for pages.dev
  • j

    Jc

    04/03/2023, 5:37 PM
    i'm trying to fix this for preview builds:
    Copy code
    Refused to load the font 'https://<preview>.pages.dev/<path>.woff2' because it violates the following Content Security Policy directive: "font-src data: https://fonts.gstatic.com".
    update: oh snap i think i can use this - https://developers.cloudflare.com/pages/platform/headers
1...366367368...392Latest