Git Product home page Git Product logo

pages-plugins's Introduction

Pages Plugins

Features

  • 🥞 Completely composable

    You can include multiple Plugins, Plugins can rely on other Plugins, and they all share the same loading interface.

  • ✍️ Author a Plugin as a folder of Functions

    The straight-forward syntax and intuitive file-based routing we've developed for Functions can be used to write Plugins.

  • 📥 Simple loading mechanism for including Plugins in projects

    Mount the Plugin wherever you want and optionally pass it data.

  • ⚡️ Plugins can bring static assets

    We hide static assets behind an inaccessible URL so they'll only be available in user-land where the Plugin exposes them.

Usage

Check out our Developer Docs for an example of creating and mounting a Pages Plugin.

Plugins

Check out these examples:

pages-plugins's People

Contributors

ekwuno avatar github-actions[bot] avatar gregbrimble avatar jahands avatar klaemo avatar savtrip avatar tobigumo avatar worenga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pages-plugins's Issues

Cloudflare Access Pages Plugin always return 302

Cloudflare Access Pages Plugin always return 302 and redirected to https://myteamname.cloudflareaccess.com/cdn-cgi/access/login/... login page even if have an authenticated JWT token.

Problem

I researched problem and I found 2 errors below.

  • There are no typ claim in JWT payload.
  • A aud claim is not string but array like aud : [ "..." ].

Dependencies

  "devDependencies": {
    "@cloudflare/workers-types": "^3.17.0",
    "@sveltejs/vite-plugin-svelte": "^1.0.2",
    "@tsconfig/svelte": "^3.0.0",
    "svelte": "^3.49.0",
    "svelte-check": "^2.8.1",
    "svelte-preprocess": "^4.10.7",
    "tslib": "^2.4.0",
    "typescript": "^4.6.4",
    "vite": "^3.1.0"
  },
  "dependencies": {
    "@cloudflare/pages-plugin-cloudflare-access": "^1.0.1"
  }

Cloudflare Static Form only returns 200 status OK codes

Here's how to replicate the bug:

  1. Go to the docs, copy the commands and code.
  2. Create another function designed to redirect by adding /functions/test.js:
// functions/test.js
export function onRequest(context) {
            return Response.redirect("https://example.com/about/", 302)
          }
  1. Deploy to Cloudflare pages. Check the /test/ route with curl.

You'll get a blank body and it has a status 200 OK but a valid location header for /about/. The response object is created successfully but transformed by the plugin to have a 200 code instead.

This is fixed by removing the static forms plugin. MailChannels uses static forms, and shares this bug. Installing either breaks redirects.

Because it's deployed as middleware, any attempt to change codes with functions across the site breaks. The solution has been to strip out the transform added when the function is compiled. It's applied to the handler's response to check for status codes:

var cloneResponse = (response) => new Response(
  [101, 204, 205, 304].includes(response.status) ? null : response.body,
  response
);

Once removed, everything works as expected. I haven't tested using the Response.clone() instead because I don't see why a custom handler function needs this kind of check on it.

No Loader is Configured for `.wasm` Files

When installing the new @cloudflare/pages-plugin-vercel-og plugin, as soon as it is installed with a function created (I used the sample code used in the docs) it fails to build the worker, both locally using wrangler pages dev and when publishing to Pages.

My function.

import React from "react";
import { ImageResponse } from "@cloudflare/pages-plugin-vercel-og/api";

export const onRequest: PagesFunction = async () => {
  return new ImageResponse(<div style={{ display: "flex" }}> Hello, world! </div>, {
    width: 1200,
    height: 630,
  });
};

The error.

Compiling worker to "/var/folders/l5/qwl85bgn0hd2d6r5f_qxm7680000gn/T/functionsWorker-0.4420685186419462.mjs"...
✘ [ERROR] 2 error(s) and 0 warning(s) when compiling Worker.

✘ [ERROR] No loader is configured for ".wasm" files: ../node_modules/@vercel/og/dist/resvg.wasm?module

    ../node_modules/@vercel/og/dist/index.edge.js:9:23:
      9 │ import resvg_wasm from "./resvg.wasm?module";
        ╵                        ~~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No loader is configured for ".wasm" files: ../node_modules/@vercel/og/dist/yoga.wasm?module

    ../node_modules/@vercel/og/dist/index.edge.js:10:22:
      10 │ import yoga_wasm from "./yoga.wasm?module";
         ╵                       ~~~~~~~~~~~~~~~~~~~~

✘ [ERROR] Build failed with 2 errors:

  ../node_modules/@vercel/og/dist/index.edge.js:9:23: ERROR: No loader is configured for ".wasm"
  files: ../node_modules/@vercel/og/dist/resvg.wasm?module
  ../node_modules/@vercel/og/dist/index.edge.js:10:22: ERROR: No loader is configured for ".wasm"
  files: ../node_modules/@vercel/og/dist/yoga.wasm?module

@cloudflare/pages-plugin-graphql fails with an internal error occurred

Relates to #12

Steps to Reproduce

https://github.com/remarkablemark/cloudflare-functions-demo

I copied and pasted the Cloudflare's official doc on GraphQL Pages Plugin

Expected

No Cloudflare Pages build failure.

Actual

Build failure:

2023-03-12T23:37:48.346296Z	Cloning repository...
2023-03-12T23:37:49.177812Z	From https://github.com/remarkablemark/cloudflare-functions-demo
2023-03-12T23:37:49.178437Z	 * branch            8df362a48bb341219070f8e6f083eb7bd2e27ae7 -> FETCH_HEAD
2023-03-12T23:37:49.17868Z	
2023-03-12T23:37:49.220667Z	HEAD is now at 8df362a feat(functions): add graphql
2023-03-12T23:37:49.221262Z	
2023-03-12T23:37:49.372136Z	
2023-03-12T23:37:49.404629Z	Success: Finished cloning repository files
2023-03-12T23:37:50.080897Z	Installing dependencies
2023-03-12T23:37:50.092025Z	Python version set to 2.7
2023-03-12T23:37:52.09027Z	Attempting node version '16' from .nvmrc
2023-03-12T23:37:53.556349Z	Downloading and installing node v16.19.1...
2023-03-12T23:37:53.985716Z	Downloading https://nodejs.org/dist/v16.19.1/node-v16.19.1-linux-x64.tar.xz...
2023-03-12T23:37:54.446482Z	Computing checksum with sha256sum
2023-03-12T23:37:54.578234Z	Checksums matched!
2023-03-12T23:37:59.077338Z	Now using node v16.19.1 (npm v8.19.3)
2023-03-12T23:37:59.514748Z	Started restoring cached build plugins
2023-03-12T23:37:59.529242Z	Finished restoring cached build plugins
2023-03-12T23:38:00.035109Z	Attempting ruby version 2.7.1, read from environment
2023-03-12T23:38:03.797687Z	Using ruby version 2.7.1
2023-03-12T23:38:04.171332Z	Using PHP version 5.6
2023-03-12T23:38:04.343956Z	5.2 is already installed.
2023-03-12T23:38:04.373226Z	Using Swift version 5.2
2023-03-12T23:38:04.374033Z	Started restoring cached node modules
2023-03-12T23:38:04.391976Z	Finished restoring cached node modules
2023-03-12T23:38:04.947063Z	Installing NPM modules using NPM version 8.19.3
2023-03-12T23:38:05.389871Z	npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
2023-03-12T23:38:05.390385Z	npm WARN config location in the cache, and they are managed by
2023-03-12T23:38:05.39057Z	npm WARN config     [`cacache`](http://npm.im/cacache).
2023-03-12T23:38:05.813524Z	npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
2023-03-12T23:38:05.814055Z	npm WARN config location in the cache, and they are managed by
2023-03-12T23:38:05.814272Z	npm WARN config     [`cacache`](http://npm.im/cacache).
2023-03-12T23:38:07.211455Z	
2023-03-12T23:38:07.212089Z	added 4 packages, and audited 5 packages in 1s
2023-03-12T23:38:07.212326Z	
2023-03-12T23:38:07.21247Z	found 0 vulnerabilities
2023-03-12T23:38:07.22347Z	NPM modules installed
2023-03-12T23:38:07.803083Z	npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
2023-03-12T23:38:07.803442Z	npm WARN config location in the cache, and they are managed by
2023-03-12T23:38:07.803638Z	npm WARN config     [`cacache`](http://npm.im/cacache).
2023-03-12T23:38:07.823143Z	Installing Hugo 0.54.0
2023-03-12T23:38:08.667354Z	Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
2023-03-12T23:38:08.671785Z	Started restoring cached go cache
2023-03-12T23:38:08.693349Z	Finished restoring cached go cache
2023-03-12T23:38:08.84449Z	go version go1.14.4 linux/amd64
2023-03-12T23:38:08.859244Z	go version go1.14.4 linux/amd64
2023-03-12T23:38:08.862244Z	Installing missing commands
2023-03-12T23:38:08.862565Z	Verify run directory
2023-03-12T23:38:08.862789Z	Executing user command: npm install
2023-03-12T23:38:09.358137Z	npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
2023-03-12T23:38:09.35848Z	npm WARN config location in the cache, and they are managed by
2023-03-12T23:38:09.358655Z	npm WARN config     [`cacache`](http://npm.im/cacache).
2023-03-12T23:38:09.653146Z	
2023-03-12T23:38:09.65347Z	up to date, audited 5 packages in 326ms
2023-03-12T23:38:09.654337Z	
2023-03-12T23:38:09.654622Z	found 0 vulnerabilities
2023-03-12T23:38:09.665543Z	Finished
2023-03-12T23:38:09.666307Z	Found Functions directory at /functions. Uploading.
2023-03-12T23:38:10.409124Z	✨ Compiled Worker successfully
2023-03-12T23:38:10.441211Z	Validating asset output directory
2023-03-12T23:38:11.337595Z	Failed: an internal error occurred

This is my build config:

Screen Shot 2023-03-12 at 7 40 43 PM

Graphql Plugin on Pages Fails with internal error

I copied the GraphQL Pages Plugin hello world example to a functions/graphql.ts file (https://github.com/mhamrah/hamrah.com/blob/main/functions/graphql.ts). I can run this successfully with wrangler pages dev, but when I deploy, I get:

21:20:48.031 Compiled Worker successfully.
21:20:48.048 Validating asset output directory
21:20:49.022 Failed: an internal error occurred

Removing this file makes the deployment work. I’m wondering if anyone has insight? It should be easily reproducible.

The full output is:

2022-09-20T01:20:42.938057Z	From https://github.com/mhamrah/hamrah.com
2022-09-20T01:20:42.938754Z	 * branch            2e3a63bd53bcf10248dc10665acd3008abe1e57d -> FETCH_HEAD
2022-09-20T01:20:42.939014Z	
2022-09-20T01:20:42.984368Z	HEAD is now at 2e3a63b update tailwind
2022-09-20T01:20:42.984947Z	
2022-09-20T01:20:43.125499Z	
2022-09-20T01:20:43.152047Z	Success: Finished cloning repository files
2022-09-20T01:20:43.836375Z	Installing dependencies
2022-09-20T01:20:43.846881Z	Python version set to 2.7
2022-09-20T01:20:46.972952Z	Downloading and installing node v14.20.0...
2022-09-20T01:20:47.350731Z	Downloading https://nodejs.org/dist/v14.20.0/node-v14.20.0-linux-x64.tar.xz...
2022-09-20T01:20:47.746755Z	Computing checksum with sha256sum
2022-09-20T01:20:47.879228Z	Checksums matched!
2022-09-20T01:20:52.296193Z	Now using node v14.20.0 (npm v6.14.17)
2022-09-20T01:20:52.660845Z	Started restoring cached build plugins
2022-09-20T01:20:52.67346Z	Finished restoring cached build plugins
2022-09-20T01:20:53.141886Z	Attempting ruby version 2.7.1, read from environment
2022-09-20T01:20:56.599685Z	Using ruby version 2.7.1
2022-09-20T01:20:56.950683Z	Using PHP version 5.6
2022-09-20T01:20:57.116974Z	5.2 is already installed.
2022-09-20T01:20:57.144182Z	Using Swift version 5.2
2022-09-20T01:20:57.144671Z	Started restoring cached node modules
2022-09-20T01:20:57.160757Z	Finished restoring cached node modules
2022-09-20T01:20:57.40669Z	Installing NPM modules using NPM version 6.14.17
2022-09-20T01:20:58.351888Z	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!
2022-09-20T01:21:14.983767Z	
2022-09-20T01:21:14.984102Z	> [email protected] postinstall /opt/buildhome/repo/node_modules/core-js
2022-09-20T01:21:14.98426Z	> node -e "try{require('./postinstall')}catch(e){}"
2022-09-20T01:21:14.984379Z	
2022-09-20T01:21:15.099576Z	�[96mThank you for using core-js (�[94m https://github.com/zloirock/core-js �[96m) for polyfilling JavaScript standard library!�[0m
2022-09-20T01:21:15.099933Z	
2022-09-20T01:21:15.100103Z	�[96mThe project needs your help! Please consider supporting of core-js:�[0m
2022-09-20T01:21:15.100233Z	�[96m>�[94m https://opencollective.com/core-js �[0m
2022-09-20T01:21:15.100348Z	�[96m>�[94m https://patreon.com/zloirock �[0m
2022-09-20T01:21:15.100456Z	�[96m>�[94m bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz �[0m
2022-09-20T01:21:15.100565Z	
2022-09-20T01:21:15.100683Z	�[96mAlso, the author of core-js (�[94m https://github.com/zloirock �[96m) is looking for a good job -)�[0m
2022-09-20T01:21:15.100811Z	
2022-09-20T01:21:15.115376Z	
2022-09-20T01:21:15.115669Z	> [email protected] postinstall /opt/buildhome/repo/node_modules/esbuild
2022-09-20T01:21:15.11583Z	> node install.js
2022-09-20T01:21:15.115949Z	
2022-09-20T01:21:15.264935Z	
2022-09-20T01:21:15.265276Z	> [email protected] postinstall /opt/buildhome/repo/node_modules/browser-tabs-lock
2022-09-20T01:21:15.26546Z	> node scripts/postinstall.js
2022-09-20T01:21:15.265592Z	
2022-09-20T01:21:15.3546Z	�[93mThank you for using browser-tabs-lock (�[34m https://github.com/supertokens/browser-tabs-lock �[93m).
2022-09-20T01:21:15.354954Z	
2022-09-20T01:21:15.355121Z	�[93mThis library was created as a part of a larger project, SuperTokens(�[34m https://supertokens.io �[93m) - an open source auth solution.�[0m
2022-09-20T01:21:15.355242Z	�[93mYou can also check out our other projects on �[34mhttps://github.com/supertokens�[93m
2022-09-20T01:21:15.355368Z	�[0m
2022-09-20T01:21:15.405311Z	
2022-09-20T01:21:15.405627Z	> [email protected] postinstall /opt/buildhome/repo/node_modules/vite/node_modules/esbuild
2022-09-20T01:21:15.405826Z	> node install.js
2022-09-20T01:21:15.405958Z	
2022-09-20T01:21:15.55671Z	
2022-09-20T01:21:15.557227Z	> [email protected] postinstall /opt/buildhome/repo/node_modules/wrangler/node_modules/esbuild
2022-09-20T01:21:15.557386Z	> node install.js
2022-09-20T01:21:15.557503Z	
2022-09-20T01:21:16.190411Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (node_modules/@esbuild/linux-loong64):
2022-09-20T01:21:16.190751Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"loong64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.198853Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-windows-arm64):
2022-09-20T01:21:16.199179Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.206605Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-windows-32):
2022-09-20T01:21:16.206873Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.213712Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-sunos-64):
2022-09-20T01:21:16.213934Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"sunos","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.220681Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-windows-64):
2022-09-20T01:21:16.220889Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.227617Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-netbsd-64):
2022-09-20T01:21:16.227822Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"netbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.236067Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-openbsd-64):
2022-09-20T01:21:16.236286Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"openbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.243365Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-linux-s390x):
2022-09-20T01:21:16.24356Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"s390x"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.250363Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-linux-riscv64):
2022-09-20T01:21:16.250606Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"riscv64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.257561Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-linux-ppc64le):
2022-09-20T01:21:16.257768Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"ppc64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.264748Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-linux-mips64le):
2022-09-20T01:21:16.264958Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"mips64el"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.271741Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-linux-arm64):
2022-09-20T01:21:16.271957Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.278638Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-linux-arm):
2022-09-20T01:21:16.278904Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.285479Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-linux-32):
2022-09-20T01:21:16.285727Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.292476Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-freebsd-64):
2022-09-20T01:21:16.292682Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.300453Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-darwin-arm64):
2022-09-20T01:21:16.300693Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.307344Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-darwin-64):
2022-09-20T01:21:16.307565Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.315184Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-freebsd-arm64):
2022-09-20T01:21:16.315428Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"freebsd","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.32263Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-android-arm64):
2022-09-20T01:21:16.322911Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"android","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.33182Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/wrangler/node_modules/esbuild-android-64):
2022-09-20T01:21:16.332018Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"android","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.33662Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-windows-arm64):
2022-09-20T01:21:16.336826Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.34362Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-windows-64):
2022-09-20T01:21:16.343834Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.350718Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-windows-32):
2022-09-20T01:21:16.350949Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.357726Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-sunos-64):
2022-09-20T01:21:16.357931Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"sunos","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.364753Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-openbsd-64):
2022-09-20T01:21:16.364939Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"openbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.372854Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-netbsd-64):
2022-09-20T01:21:16.373119Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"netbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.379943Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-linux-riscv64):
2022-09-20T01:21:16.380163Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"riscv64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.387351Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-linux-s390x):
2022-09-20T01:21:16.387625Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"s390x"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.394642Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-linux-ppc64le):
2022-09-20T01:21:16.39485Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"ppc64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.402597Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-linux-mips64le):
2022-09-20T01:21:16.402806Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"mips64el"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.410194Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-linux-arm64):
2022-09-20T01:21:16.410388Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.417522Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-linux-arm):
2022-09-20T01:21:16.417741Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.424721Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-linux-32):
2022-09-20T01:21:16.424943Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.431911Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-freebsd-64):
2022-09-20T01:21:16.432223Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.440251Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-darwin-arm64):
2022-09-20T01:21:16.44045Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.447681Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-freebsd-arm64):
2022-09-20T01:21:16.447934Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"freebsd","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.45485Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-darwin-64):
2022-09-20T01:21:16.455149Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.462182Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-android-arm64):
2022-09-20T01:21:16.462396Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"android","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.469333Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/vite/node_modules/esbuild-android-64):
2022-09-20T01:21:16.469604Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"android","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.476756Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (node_modules/vite/node_modules/@esbuild/linux-loong64):
2022-09-20T01:21:16.476957Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"linux","arch":"loong64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.486571Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
2022-09-20T01:21:16.486801Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.493931Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-windows-arm64):
2022-09-20T01:21:16.494127Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.501143Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-windows-64):
2022-09-20T01:21:16.501375Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.509399Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-windows-32):
2022-09-20T01:21:16.509713Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.5165Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @esbuild/[email protected] (node_modules/@esbuild/android-arm):
2022-09-20T01:21:16.516719Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @esbuild/[email protected]: wanted {"os":"android","arch":"arm"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.523664Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-sunos-64):
2022-09-20T01:21:16.523855Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"sunos","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.530803Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-openbsd-64):
2022-09-20T01:21:16.531082Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"openbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.538025Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-netbsd-64):
2022-09-20T01:21:16.538233Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"netbsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.545529Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-linux-s390x):
2022-09-20T01:21:16.54577Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"s390x"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.552843Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-linux-riscv64):
2022-09-20T01:21:16.553066Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"riscv64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.560251Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-linux-mips64le):
2022-09-20T01:21:16.560466Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"mips64el"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.567573Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-linux-arm64):
2022-09-20T01:21:16.567809Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.576085Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-linux-ppc64le):
2022-09-20T01:21:16.576409Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"ppc64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.583292Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-linux-arm):
2022-09-20T01:21:16.583533Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.590479Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-linux-32):
2022-09-20T01:21:16.590709Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.597797Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-freebsd-arm64):
2022-09-20T01:21:16.598006Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"freebsd","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.604912Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-freebsd-64):
2022-09-20T01:21:16.605119Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.61221Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-darwin-arm64):
2022-09-20T01:21:16.612478Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.619393Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-darwin-64):
2022-09-20T01:21:16.619596Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.62663Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-android-arm64):
2022-09-20T01:21:16.626852Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"android","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.633715Z	npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/esbuild-android-64):
2022-09-20T01:21:16.633942Z	npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"android","arch":"x64"} (current: {"os":"linux","arch":"x64"})
2022-09-20T01:21:16.6344Z	
2022-09-20T01:21:16.637773Z	added 539 packages from 370 contributors and audited 601 packages in 18.328s
2022-09-20T01:21:16.826575Z	
2022-09-20T01:21:16.826916Z	188 packages are looking for funding
2022-09-20T01:21:16.827095Z	  run `npm fund` for details
2022-09-20T01:21:16.827216Z	
2022-09-20T01:21:16.827335Z	found 0 vulnerabilities
2022-09-20T01:21:16.827446Z	
2022-09-20T01:21:16.848393Z	NPM modules installed
2022-09-20T01:21:17.236633Z	Installing Hugo 0.54.0
2022-09-20T01:21:17.916914Z	Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
2022-09-20T01:21:17.921047Z	Started restoring cached go cache
2022-09-20T01:21:17.940512Z	Finished restoring cached go cache
2022-09-20T01:21:18.091184Z	go version go1.14.4 linux/amd64
2022-09-20T01:21:18.105979Z	go version go1.14.4 linux/amd64
2022-09-20T01:21:18.108834Z	Installing missing commands
2022-09-20T01:21:18.109094Z	Verify run directory
2022-09-20T01:21:18.109254Z	Executing user command: npm run build
2022-09-20T01:21:18.463797Z	
2022-09-20T01:21:18.464107Z	> @example/[email protected] build /opt/buildhome/repo
2022-09-20T01:21:18.464256Z	> astro build
2022-09-20T01:21:18.464382Z	
2022-09-20T01:21:21.270847Z	01:21:21 AM [build] output target: server
2022-09-20T01:21:21.271157Z	01:21:21 AM [build] deploy adapter: @astrojs/cloudflare
2022-09-20T01:21:21.271303Z	01:21:21 AM [build] Collecting build info...
2022-09-20T01:21:21.271714Z	01:21:21 AM [build] Completed in 24ms.
2022-09-20T01:21:21.272839Z	01:21:21 AM [build] Building server entrypoints...
2022-09-20T01:21:26.531782Z	01:21:26 AM [build] Completed in 5.26s.
2022-09-20T01:21:26.539334Z	
2022-09-20T01:21:26.539646Z	 finalizing server assets 
2022-09-20T01:21:26.539854Z	
2022-09-20T01:21:26.540047Z	01:21:26 AM [build] Rearranging server assets...
2022-09-20T01:21:26.572178Z	01:21:26 AM [build] Server built in 5.32s
2022-09-20T01:21:26.572433Z	01:21:26 AM [build] Complete!
2022-09-20T01:21:26.608964Z	Finished
2022-09-20T01:21:27.178894Z	🚧 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
2022-09-20T01:21:27.324802Z	Compiled Worker successfully.
2022-09-20T01:21:27.342675Z	Validating asset output directory
2022-09-20T01:21:28.325497Z	Failed: an internal error occurred

Is it possible to access env in cloudflare access plugin

I'm attempting to access env vars in the Cloudflare Access Pages Plugin and cannot work out how to get this to work.

My use case is the very simple option of having an environment var for the "aud" value set in production and then differently in development builds.

Is this possible and is there any examples I can refer to for this?

Sentry plugin (all middleware?) breaks cached responses

After adding the sentry plugin as middleware to my site, I started to experience very poor behavior:

  • When loading or reloading the page, there is a chance that the html response is given a status of 200 but no payload. I would expect a 304 instead, if the browser should use its cached version.
  • Sometimes the html will load, but not the CSS. It seems totally random.
  • When hard-refreshing pages, they load fine

For an example of this on a simple page, see; https://bb9fafc1.www-defined.pages.dev/. Refresh several times and you will see different behaviors.

Removing the sentry plugin resolves the issue. This is my plugin:

// functions/_middleware.ts

import sentryPlugin from "@cloudflare/pages-plugin-sentry";

export const onRequest: PagesFunction<{
  SENTRY_DSN: string;
  SENTRY_ENVIRONMENT: "production" | "deploy-preview";
}> = (context) => {
  return sentryPlugin({
    dsn: context.env.SENTRY_DSN,
    environment: context.env.SENTRY_ENVIRONMENT,
  })(context);
};

When watching the function log stream, refreshing the page will show a successful GET to /site.manifest sometimes, but not always. If the page comes up blank, I don't see a log.

Other users in Discord have also reported similar issues when using Cloudflare Access middleware. Is it possible that middleware in general is the cause of this?

Mailchannels: support for attachments

Hi, I had to make a "Work with us" form, which included a resume upload field, that obviously should be sent by mail. Looking in the Mailchannels API documentation, the plugin documentation or source code I could not find any mention about attachments. From the Mailchannels API docs it seems to be supported, but I couldn't find any example.

The only workaround I found was to use a link with a Data URI and encode the attachment there, but it doesn't work in some clients (ie. Gmail strips the link completely).

In any case, sending attachments should be available, or, if unsupported at all, that should be mentioned in the documentation.

npm ERR! 404 '@cloudflare/pages-plugin-headers@*' is not in this registry.

Receiving the following error on install via npm install --save @cloudflare/pages-plugin-headers

npm ERR! 404  '@cloudflare/pages-plugin-headers@*' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/*/.npm/_logs/2022-05-18T02_54_45_937Z-debug-0.log

cloudflare/pages-plugin-mailchannels content missing from email

According to https://developers.cloudflare.com/pages/platform/functions/plugins/mailchannels/ content is an optional array or function which returns an array. It defaults to a text/html and text/plain body array, detailing the form submission contents.

I cannot get the default content of the form data to come through.

In the code https://github.com/cloudflare/pages-plugins/blob/main/packages/mailchannels/functions/_middleware.ts it looks like it is setup to grab the form data and put it into the content, but it is not working for me.

This is my current _middleware.ts

import mailchannelsPlugin from "@cloudflare/pages-plugin-mailchannels";

export const onRequest = mailchannelsPlugin({
  personalizations: [
    {
      to: [{ name: "xxx", email: "xxx" }],
    },
  ],
  from: { name: "xxx", email: "xxxx" },
  respondWith: () =>
    new Response(null, {
      status: 200,
    }),
});

Expected results:

Receive an email with the default subject line and the form contents in the body of the email.

Actual results:

The email comes through with the default subject line, but the body of the email is blank.

Local pages graphql plugin dev fails with framework

When doing local development using a framework (e.g. wrangler pages dev -- next dev), the GraphQL plugin fails to compile with the below error:

../node_modules/@cloudflare/pages-plugin-graphql/index.js:2:26: ERROR: Do not know how to load
  path:
  assets:/myproject/node_modules/@cloudflare/pages-plugin-graphql/static

This line seeming to be the problem: import { onRequest } from "assets:./static";

Static Forms and Mailchannels Plugin breaking other forms

While the documentation says these plugins "intercept all form submissions made which have the data-static-form-name attribute set", they were breaking the search function and other forms on my site which do not have that attribute set. I was able to restore the expected behavior by replacing:

return new HTMLRewriter().on("form", {

with:

return new HTMLRewriter().on('[data-static-form-name]', {

pages-plugin-vercel-og not working with sveltekit when we import `ImageResponse` from `@cloudflare/pages-plugin-vercel-og/api`

When we use ImageResponse from @cloudflare/pages-plugin-vercel-og/api it's not gonna copy the required files in correct folder.

Error: ENOENT: no such file or directory, open '/Users/shivammeena/WebstormProjects/svelte-h2j/example/cf-pages/.svelte-kit/output/server/chunks/noto-sans-v27-latin-regular.ttf'
    at Object.openSync (node:fs:600:3)
    at Object.readFileSync (node:fs:468:35)
    at file:///Users/shivammeena/WebstormProjects/svelte-h2j/example/cf-pages/.svelte-kit/output/server/chunks/index.node.js:39451:21
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
    at async analyse (file:///Users/shivammeena/WebstormProjects/svelte-h2j/example/cf-pages/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js:83:16)
    at async MessagePort.<anonymous> (file:///Users/shivammeena/WebstormProjects/svelte-h2j/example/cf-pages/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/utils/fork.js:22:16)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:290:10)
    at [kOnMessage] (node:internal/worker:301:37)
    at MessagePort.<anonymous> (node:internal/worker:202:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:731:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/Users/shivammeena/WebstormProjects/svelte-h2j/example/cf-pages/.svelte-kit/output/server/chunks/noto-sans-v27-latin-regular.ttf'
}

Node.js v18.12.1

Steps to reproduce

  1. Clone https://github.com/etherCorps/svelte-h2j and use example branch
  2. In project you will find the example directory which contains cf-pages which is the project where i used @cloudflare/pages-plugin-vercel-og/api.

Error handling

Hello,

How exactly does one handle errors? It seems all plugin examples include return upon success.

I for example do not understand this "syntax"... can you please explain?

Consider the hCaptcha plugin:

import hCaptchaPlugin from "@cloudflare/pages-plugin-hcaptcha";

export const onRequestPost: PagesFunction[] = [
  hcaptchaPlugin({
    secret: "0x0000000000000000000000000000000000000000",
    sitekey: "10000000-ffff-ffff-ffff-000000000001",
  }),
  (async ({ request }) => {
    // Request has been validated as coming from a human

    const formData = await request.formData()

    // Store user credentials

    return new Response("Successfully registered!")
  })

];

Where and how do I catch errors?

Thanks

Static Forms and Mailchannels Plugin hidden input missing causes 405 error

I have a static website (using Nuxt generate static & ssr), and trying to send email from a form, however on submit I got a 405 error page and no email sent, explained below with code...

contact.vue

<form data-static-form-name="sales">
    <label>Email address <input type="email" name="email" /></label>
    <label>Message <textarea name="message"></textarea></label>

    <!-- If the `<form>` has any custom child component, the hidden input (below) is not included -->
    <base-icon icon="my-icon" />

    <button type="Submit">submit</button>

    <!-- Including it manually fixes the problem -->
    <input type="hidden" name="static-form-name" value="sales">
  </form>

Mailchannels: Better Error Message on Failure

I've followed the docs trying to get Mailchannels working:

But I always just get the error message:
Could not send your email. Please try again.

The source of which I discovered here:

https://github.com/cloudflare/pages-plugins/blob/main/packages/mailchannels/functions/_middleware.ts#L100-L102

A more descriptive error would be more helpful for debugging problems. When googling I've noticed a lot of others get confused too. I think more information would be much appreciated. Or at least return the error so our users code can choose to log it etc.

Is there any way to get more info or debug how configuration is failing?

Cloudflare Access Plugin returns 200 status with body

I am trying to use Cloudflare Access Plugin to Authenticate a few pages in my App and generateLoginURL & generateLogoutURL functions work, but I try putting a middleware that contains a code like :-

import cloudflareAccessPlugin from "@cloudflare/pages-plugin-cloudflare-access";

export const onRequest: PagesFunction = cloudflareAccessPlugin({  
  domain: "https://test.cloudflareaccess.com",  
  aud: "4714c1358e65fe4b408ad6d432a5f878f08194bdb4752441fd56faefa9b2b6f2",
});

it's just returning 200 status code without any kind of body. what's the problem? what's should I do?

Also there's no error handling or throwing in Cloudflare Account Plugin https://github.com/cloudflare/pages-plugins/blob/main/packages/cloudflare-access/functions/_middleware.ts#L136

Note, that I am using Google Authentication that I have configured in My Cloudflare Zero Trust Access Account. Thanks.

Is this repo maintained?

It appears that the issues are not being handled effectively or addressed in a timely manner. Cloudflare, are there any plans to resolve these issues?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.