Ben Cox
Ben Cox
CDCloudflare Developers
Created by Ben Cox on 7/18/2023 in #pages-help
Pages Function naming causes failure
hq-simple-astro-spike.pages.dev, Account ID: 9f4ca528def6cd26be618a8891cc757e, Deployment: 0406c190-2493-4e13-9e5d-9cd4e3159036 Navigating to https://0406c190.hq-simple-astro-spike.pages.dev/helloworld, I get: Error 1101 Ray ID: 7e8756453bbe1567 • 2023-07-18 02:36:25 UTC Worker threw exception In the log, I find:
exceptions: [{ "name": "TypeError", "message": "Unexpected MODIFIER at 27, expected END", "timestamp": 1689647785804 }] In addition to helloworld.js, I deployed a file at functions/teacher-directory/[[td-path]].ts. This caused the error - not just in that particular function but every function, including the most basic helloworld.js example! This isn't a build-time or deploy-time error. After deployment the Functions tab shows: { "routes": [ { "routePath": "/teacher-directory/:td-path*", "mountPath": "/teacher-directory", "method": "", "module": [ "teacher-directory/[[td-path]].js:onRequest" ] }, { "routePath": "/helloworld", "mountPath": "/", "method": "", "module": [ "helloworld.js:onRequest" ] } ], "baseURL": "/" } It was perfectly happy to build and deploy this function, but at runtime it broke all functions. No mention is in the docs (here: https://developers.cloudflare.com/pages/platform/functions/routing/#multipath-segments) about any filename specifications restricting dashes. Note, the directory may have a dash without issue. Is it possible to 1. document these requirements, and 2. trigger a deploy-time error for this, rather than breaking the website?
1 replies