https://discord.cloudflare.com logo
Join Discord
Powered by
# pages-plugins
  • e

    eettmm

    11/09/2022, 4:25 PM
    hey! anyone got any luck with MailChannels Pages plugin working with NextJS?
  • e

    eettmm

    11/09/2022, 4:26 PM
    I got it working with Static site but doesn't seems to be working with NextJS
  • e

    eettmm

    11/09/2022, 4:26 PM
    any help would be appreciated. thank you!!
  • t

    Trixrabbit

    11/21/2022, 10:41 PM
    Hey guys, just want to confirm I'm not doing something wrong before opening an issue. I'm trying to deploy a sveltekit app using github workflows instead of Cloudflare CI (just because I have other things that needs to happen before). I'm trying to use the cloudflare-wrangler action (https://github.com/cloudflare/wrangler-action) and specifically this step :
    Copy code
    yml
    on: [push]
    
    jobs:
      deploy:
        runs-on: ubuntu-latest
        name: Deploy
        steps:
          - uses: actions/checkout@v3
          - name: Publish
            uses: cloudflare/wrangler-action@2.0.0
            with:
              apiToken: ${{ secrets.CF_API_TOKEN }}
              accountId: ${{ secrets.CF_ACCOUNT_ID }}
              command: pages publish --project-name=example
    And I'm getting : [ERROR] Must specify a directory. From the Wrangler docs, the directory is mandatory, so I'm assuming it is simply missing from the wrangler-action examples
  • w

    Walshy | Pages

    11/21/2022, 10:43 PM
    you need to specify the directory of your static assets
  • w

    Walshy | Pages

    11/21/2022, 10:43 PM
    Wrangler needs to know where your site is
  • t

    Trixrabbit

    11/21/2022, 10:47 PM
    yes, my question was more just a nit: Should the wrangler-action doc specify that you need to pass the directory, or should anyone that use this template hit the error and then fill the missing directory e.g.
    Copy code
    yml
     command: pages publish ./example-directory --project-name=example
  • n

    niet

    11/22/2022, 12:55 PM
    Good Morning, has anyone had any luck getting the cloudflare-access plugin working with remix? For some reason when I add the plugin the pages app just shows a solid white screen. If so, does anyone have any working examples? Thank you in advance for your time.
  • s

    springogeek

    11/26/2022, 11:46 AM
    Hi there. I'm trying to make a "Contact Us" email form using the mailchannels pages plugin, but it doesn't seem to work. I've followed the instructions I can find in the documentation, but nothing seems to actually happen, so I can't tell if things are actually set up correctly. I'm uploading a
    functions/_middleware.ts
    file, there's a form on the page, but no emails seem to be sent.
  • s

    springogeek

    11/26/2022, 11:57 AM
    Here's what I have:
    Copy code
    typescript
    import mailchannelsPlugin from "@cloudflare/pages-plugin-mailchannels";
    
    const errorHandler: PagesFunction = async ({ next }) => {
      try {
        return await next();
      } catch (err) {
        return new Response(`${err.message}\n${err.stack}`, { status: 500 });
      }
    };
    
    const mailChannels = (context) => mailchannelsPlugin({
      personalizations: () => {
        return [
          {
            to: [{ name: "<my name>", email: "<my email>" }],
          }
        ];
      },
      from: ({ formData }) => {
        return { name: "Enquiry", email: formData.get('email') };
      },
      respondWith: ({ formData, name }) => {
        return new Response(null, {
          status: 302,
          headers: { Location: "/" },
        }),
       
    })(context);
    
    export const onRequest: PagesFunction[] = [errorHandler, mailMiddleware];
  • d

    DemosJarco

    12/01/2022, 10:56 PM
    I was able to narrow down the error to the missing package
    graphql
    . But what I don't understand is I already had it installed with
    npm i graphql
    and
    wrangler pages dev
    works.
    Copy code
    accesslog
    15:19:08.139    1 error(s) and 0 warning(s) when compiling Worker.
    15:19:08.141    
    15:19:08.254    ✘ [ERROR] Could not resolve "graphql"
    15:19:08.254    
    15:19:08.255        api.ts:2:73:
    15:19:08.255          2 │ ..., GraphQLSchema, GraphQLObjectType, GraphQLString } from 'graphql';
    15:19:08.255            ╵                                                             ~~~~~~~~~
    15:19:08.255    
    15:19:08.255      You can mark the path "graphql" as external to exclude it from the bundle, which will remove this error.
    15:19:08.256    
    15:19:08.256    
    15:19:08.257    ✘ [ERROR] Build failed with 1 error:
    15:19:08.257    
    15:19:08.257      api.ts:2:73: ERROR: Could not resolve "graphql"
    15:19:08.258    
    15:19:08.258    
    15:19:08.269    Failed building Pages Functions from /functions.
    15:19:09.253    Failed: an internal error occurred
  • d

    DemosJarco

    12/01/2022, 10:56 PM
    But for some reason pages won't install that package (but will install every other package in package-lock.json)
  • d

    DemosJarco

    12/01/2022, 10:57 PM
    (using https://developers.cloudflare.com/pages/platform/functions/plugins/graphql/)
  • o

    osa

    12/02/2022, 1:40 PM
    Just to make sure.. It's in the
    dependencies
    section of package.json and not
    devDependencies
    ?
  • d

    DemosJarco

    12/02/2022, 3:18 PM
    Yup, regular
    dependencies
    . Although I did modify the build script to install dev too
  • d

    DemosJarco

    12/02/2022, 3:22 PM
    Copy code
    json
            "dependencies": { 
                     "@builder.io/qwik": "^0.15.0", 
                     "@builder.io/qwik-city": "^0.0.128", 
                     "@cloudflare/pages-plugin-graphql": "^1.0.0", 
                     "graphql": "^16.6.0" 
             }, 
             "devDependencies": { 
                     "@cloudflare/workers-types": "^4.20221111.1", 
                     "@types/eslint": "^8.4.10", 
                     "@types/node": "^18.11.10", 
                     "@typescript-eslint/eslint-plugin": "^5.45.0", 
                     "@typescript-eslint/parser": "^5.45.0", 
                     "eslint": "^8.28.0", 
                     "eslint-plugin-qwik": "^0.15.0", 
                     "node-fetch": "^3.3.0", 
                     "prettier": "^2.8.0", 
                     "typescript": "^4.9.3", 
                     "vite": "^3.2.4", 
                     "vite-tsconfig-paths": "^3.6.0", 
                     "wrangler": "^2.5.0" 
             }
  • s

    SirKainey

    12/08/2022, 11:26 AM
    Hey guys, trying to get the MailChannels plugin working. Whether local or on cloudflare pages it seems to get the 512 response "Could not send your email. Please try again.", after digging into the plugin it seems I am actually getting a 401 http status. I also can't get this working with postman either. I've not really modified the demo on https://developers.cloudflare.com/pages/platform/functions/plugins/mailchannels/ except for sending it to my own email address. The build is using astrojs with the 'directory' mode, I've got the helloworld pages function working too.
  • s

    SirKainey

    12/08/2022, 11:35 AM
    Did you ever manage to get this working?
  • e

    eettmm

    12/13/2022, 3:50 PM
    Hey all! Is it possible to chain multiple pages plugins
  • s

    Skye

    12/13/2022, 3:58 PM
    It should work fine, yes 🙂
  • k

    klaemo

    12/15/2022, 9:27 AM
    Be aware of this bug when using pages plugins: https://github.com/cloudflare/wrangler2/issues/2145
  • e

    edheltzel

    12/24/2022, 5:07 PM
    Does anyone know if there is a list of community and official plugins? I know the docs have some...
  • v

    Vero 🐙

    12/27/2022, 9:57 AM
    Yep, we have it in the docs, don't know if there's another list. https://developers.cloudflare.com/pages/platform/functions/plugins/
  • x

    X-Fact

    12/28/2022, 6:47 PM
    Hi, I have a project on pages and tried to add custom hostnames (saas) to the page. The domain/origin works perfectly, and the setup is done like in https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/start/getting-started/, but the custom hostname (customer domain, CNAMED to the domain of the page) gets 522 Connection timed out. Unfortunately, I can't write in the #897916119782928394
  • c

    charl

    12/29/2022, 10:46 PM
    Might be off some help https://discord.com/channels/595317990191398933/1012440514135593083/1053021638804906074
  • c

    charl

    12/29/2022, 10:47 PM
    Read that post and above
  • x

    X-Fact

    12/30/2022, 8:32 AM
    Thank you very much!
  • t

    TJ

    01/08/2023, 2:58 PM
    Hello - I see a few posts about issues using MailChannels Pages Plugin but no solutions. I am also having challenges with it. https://developers.cloudflare.com/pages/platform/functions/plugins/mailchannels/ I have a simple Pages site, following the demo. I personalized the email to send to me, and copied the @Cloudflare folder to the root (just in case that was needed). I uploaded a local folder to Pages, but the contact form does not trigger an email. Any tips or guidance is appreciated! For reference, the file/folder structure I uploaded is the following >> Assets uploaded: 18 Files uploaded -------------------------------------- contact.html index.html package-lock.json package.json >@Cloudflare >pages-plugin-mailchannels >functions _middleware.ts >node_modules .package-lock.json @cloudflare
  • t

    TJ

    01/08/2023, 6:52 PM
    FYI: I gave up on the plugin and just used a worker with airtable to collect form submissions.
  • v

    Vero 🐙

    01/18/2023, 11:05 AM
    ------------------------------ This channel is archived, please use #789155108529111069 or #1063191651796914276 ------------------------------