I am trying to create a set of dynamic pages at the root of a Gatsby 3 project. Gatsby's File System Route API provides the ability to create client-paths using the following syntax
[name_goes_here].ext
which in turn passes the value of names_goes_here
to the file [names_goes_here].ext
.
This functionality works fine when using nested folder structures such as /app/[user]/..
but results in a 404 when the dynamic folder exists in the root, ex: /[app]/../..
. However, the failure only occurs on the index.ext
of the dynamic folder and not in any of its subdirectories / non-index files. [app]/subdir/...
and [app]/file.ext
will be resolved but [app]/index.ext
will not.
Gatsby returns the following error when attempting to request the index file.
GET http://localhost:8001/13/undefinedundefined/13/ 404
where 13
is the value provided as the path parameter.
File structure (src/
):
.
├── images
│ ├── index.d.ts
│ ├── logo.png
├── index.d.ts
├── pages
│ ├── 404.tsx
│ ├── [app]
│ │ ├── file1.tsx
│ │ └── index.tsx
│ ├── file3.tsx
│ ├── subdir1
│ │ ├── file4.tsx
│ │ ├── file5.tsx
│ │ ├── file6.tsx
│ │ ├── index.tsx
│ │ ├── file7.tsx
│ │ ├── file8.tsx
│ │ ├── subdir2/
│ │ └── file9.tsx
│ ├── file10.tsx
│ ├── index.tsx
│ ├── file11.tsx
└──
Why are the subdirectories being resolved but the index file is not?