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

    Walshy | Pages

    01/09/2023, 12:28 AM
    Is there plans? Yes. When? Absolutely no idea. Could be this year, could be in 5. I don't know
  • m

    mpeg

    01/09/2023, 12:38 AM
    fair enough, I'm just curious as I like using pages for the extra features on top of workers, but have sometimes needed to deploy DOs too
  • b

    bkyerv

    01/09/2023, 3:04 AM
    out of curiosity what do you use DOs for?
  • m

    mpeg

    01/09/2023, 3:18 AM
    Needed atomic db operations, can’t implement with KV alone as it’s eventually consistent. I think D1 will have transactions so that would work but in the meantime I implemented a form of it using a DO that effectively takes a write lock on a KV object
  • b

    bkyerv

    01/09/2023, 3:19 AM
    I see
  • t

    TL&D

    01/09/2023, 11:42 AM
    Could you help me because my project is not being distributed to cloudflare global network?
  • e

    Erisa | Support Engineer

    01/09/2023, 11:43 AM
    Do you know the deployment ID or the projects
    pages.dev
    domain?
  • t

    TL&D

    01/09/2023, 11:43 AM
    goldenhand-maple.pages.dev !
  • e

    Erisa | Support Engineer

    01/09/2023, 11:44 AM
    Hmm looks like it may be a problem with your functions code, are you able to share it at all?
  • t

    TL&D

    01/09/2023, 11:48 AM
    Um... I don't think it's going to be easy to share using cloudflare-pages nitro preset of nuxt3. there was no error in the build process, but is there a process I need to check?
  • d

    Dani Foldi

    01/09/2023, 11:48 AM
    is the project open-source?
  • t

    TL&D

    01/09/2023, 11:49 AM
    no.. this is my private project
  • d

    Dani Foldi

    01/09/2023, 11:49 AM
    hmm, can you then build locally with
    NITRO_PRESET=cloudflare_pages
    and show a few lines around 3620 where
    To
    is getting constructed?
  • d

    Dani Foldi

    01/09/2023, 11:50 AM
    I've run into similar random issues before, most of the time it was a module doing something weird
  • t

    TL&D

    01/09/2023, 11:53 AM
    WARN 'createDecipheriv' is not exported by '__vite-browser-external' warning was printed during build.
  • d

    Dani Foldi

    01/09/2023, 11:55 AM
    are you using divriots/browser-vite by any chance?
  • t

    TL&D

    01/09/2023, 12:03 PM
    No I'm just using vite that works based on nuxt 3.0.0.
  • d

    Dani Foldi

    01/09/2023, 12:10 PM
    createDecipheriv is a node:crypto function, isn't it? I don't think SubtleCrypto has it
  • t

    TL&D

    01/09/2023, 12:11 PM
    Should I use subtlecrypto for cloudflare pages functions?
  • d

    Dani Foldi

    01/09/2023, 12:12 PM
    if you can, it's easier to use the natively available
    crypto.subtle.<whatever>
    functions (https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) even though nuxt polyfills node:crypto via unenv
  • t

    TL&D

    01/09/2023, 12:13 PM
    Oh, okay. I'll try to change it, and if the same problem persists, I'll be back. Thank you for your help.
  • d

    Dani Foldi

    01/09/2023, 12:14 PM
    No worries, I'm looking at unenv's docs now, it looks like they only have empty mocks for crypto, so it wouldn't work during runtime even if everything succeeded
  • t

    TL&D

    01/09/2023, 1:34 PM
    After changing to 'subtle' encryption, the warning output during build disappeared, but the problem of not being deployed is the same. In addition, when 'subtle' encryption is used, 'window is not defined' occurs because encryption works on the server when developed and tested locally.
  • d

    Dani Foldi

    01/09/2023, 1:35 PM
    could you try building without minification to see what it's trying to construct?
  • d

    Dani Foldi

    01/09/2023, 1:36 PM
    I don't have the exact config option on top of my head, it's somewhere in vite: {}
  • t

    TL&D

    01/09/2023, 1:37 PM
    I don't understand what you're saying.
  • d

    Dani Foldi

    01/09/2023, 1:39 PM
    so that
    new To
    or similar is actually something longer like
    new MyClass
     in the original code for example, just minified=renamed when imported so the code is smaller, saves quite a few characters every time it's referenced
  • g

    Glare

    01/09/2023, 5:44 PM
    Hiya, quick question: So I have a project I'm working on that is on Cloudflare Pages and it allows a user to drag and drop a CSV onto the page and it parses it. I'm looking at creating a share function where the current route is something like
    domain.tld/battle/
    , but if they click the "share" button I want to push it to a KV, and generate a random UUID where it would be like
    domain.tld/battle/UUID
    and it would render it from the KV. Would I want to use Functions for this, or should I just create a standalone worker to pull / push to the KV to handle that kind of data? (For what it's worth, I'm using Nuxt 3 SSG atm.)
  • g

    Glare

    01/09/2023, 5:56 PM
    Or I guess a simpler question would be if I did it as a function, how would I call it from a page in Nuxt to retrieve / insert data? Just do an await fetch? I guess a PUT for inserting the data and a GET for returning?
  • w

    Walshy | Pages

    01/09/2023, 6:03 PM
    Yep that sounds good to me
1...328329330...392Latest