Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguious / not clear where to put the _routes.json file #20819

Open
syonfox opened this issue Mar 14, 2025 · 2 comments
Open

Ambiguious / not clear where to put the _routes.json file #20819

syonfox opened this issue Mar 14, 2025 · 2 comments
Assignees
Labels
content:edit Request for content edits documentation Documentation edits product:pages

Comments

@syonfox
Copy link

syonfox commented Mar 14, 2025

Existing documentation URL(s)

What changes are you suggesting?

Create a _routes.json file to control when your Function is invoked. It should be placed in the output directory of your project.

I found the solution from the dashboard but maybe it should specify the directory explicitly as it is ambiguous what the 'output directory is' is it the root or the public folder or the functions folder I didn't know and put it in the root of the project so it was being ignored.

Invocation routes determine when your Functions script is executed. This file is generated based on the files present in the /functions directory.

(from function section of pages project)

@syonfox
Copy link
Author

syonfox commented Mar 14, 2025

Hmm also note that I have placed the _routes file and it is not being respected,

Image

I can see that the version Im using has a new option for configuring this in the project settings.

This should also be documented. and also maybe the _routes should override this.

Im not sure what is best but I would prefer to not have to change the code.

Ps it might be nice to mention the compatibility date of the change maybe .

@syonfox
Copy link
Author

syonfox commented Mar 14, 2025

Sorry the above seems to not be the same thing that is for what file changes will trigger a build.

<pre class="c_c c_bx c_kv c_jq c_jh c_ji c_fd c_wp c_yq c_yr c_ys c_ij c_ik c_ur c_bz c_ov">
06:01:34.655 | Finished
-- | --
06:01:35.574 | Checking for configuration in a Wrangler configuration file (BETA)
06:01:35.575 |  
06:01:36.675 | No wrangler.toml file found. Continuing.
06:01:36.675 | Found Functions directory at /functions. Uploading.
06:01:36.681 | ⛅️ wrangler 3.101.0

</pre>

It seems eve nthou i have a /_routes.json and a /functions/_routes.json It is being ignored and generated.

06:01:29.925 | [EI] Copied: src/functions/_routes.json -> ./functions/_routes.json
-- | --


Maybe this is a bug not a documentation problems. as my project does have them in both places.

Any insight into how to get the _routes working properly would be great. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content:edit Request for content edits documentation Documentation edits product:pages
Projects
None yet
Development

No branches or pull requests

6 participants