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

Middleware execution order inverted when using a deeper directory structure #110

Closed
jorbuedo opened this issue Dec 14, 2021 · 0 comments Β· Fixed by #217
Closed

Middleware execution order inverted when using a deeper directory structure #110

jorbuedo opened this issue Dec 14, 2021 · 0 comments Β· Fixed by #217
Labels
pages Relating to Pages

Comments

@jorbuedo
Copy link

πŸ› Bug report

Describe the bug

Using latest alpha version: 0.0.0-ae4fe86

With this file structure everything works fine, A executes before B:

β”œβ”€β”€ functions
β”‚   β”œβ”€β”€ _middleware.ts        # Middleware A
β”‚   β”œβ”€β”€ ...
β”‚   └── todos
β”‚       β”œβ”€β”€ _middleware.ts    # Middleware B
β”‚       β”œβ”€β”€ ...
└── ...

With this one, B executes before A:

β”œβ”€β”€ functions
β”‚   └──  api
β”‚      β”œβ”€β”€ _middleware.ts       # Middleware A
β”‚      β”œβ”€β”€ ...
β”‚      └── todos
β”‚         β”œβ”€β”€ _middleware.ts    # Middleware B
β”‚         β”œβ”€β”€ ...
└── ...

Reproduce the bug

A list of steps to reproduce the bug.

  1. Create the above file structure
  2. Run wrangler pages dev
  3. Add console.log statements on each and inside a deeper endpoint

Expected behavior

Middleware should always be executed top to bottom.

Environment and versions

Fill out the following information about your environment.

  • operating system: ubuntu
  • output of wrangler -v: 0.0.0-ae4fe86
  • output of node -v: v16.13.1
  • content of wrangler.toml: none
@threepointone threepointone added bug pages Relating to Pages labels Dec 14, 2021
GregBrimble pushed a commit that referenced this issue Feb 8, 2024
GregBrimble pushed a commit that referenced this issue Feb 9, 2024
GregBrimble pushed a commit that referenced this issue Feb 9, 2024
petebacondarwin pushed a commit to petebacondarwin/wrangler2 that referenced this issue Dec 17, 2024
* Made output directories overridable

* Added output directory tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pages Relating to Pages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants