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

Add middleware support #113

Merged
merged 5 commits into from
Nov 4, 2024
Merged

Add middleware support #113

merged 5 commits into from
Nov 4, 2024

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Oct 30, 2024

It's missing e2e tests in the added middleware example but everything seems to be working fine 🎉

Many thanks to @conico974 for merging the required changes in @opennextjs/aws !

Known issues as of Oct 31, 2024:

  • It is not possible to set headers in middleware/next config yet but that should come next week.

Copy link

changeset-bot bot commented Oct 30, 2024

⚠️ No Changeset found

Latest commit: 8c022f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

pkg-pr-new bot commented Oct 30, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@113

commit: cee60bc

@vicb vicb force-pushed the open-next branch 2 times, most recently from feb269e to 1debd9b Compare October 30, 2024 21:50
Copy link

@conico974 conico974 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few question/comment.
Great job anyway

examples/api/open-next.config.ts Outdated Show resolved Hide resolved
examples/api/open-next.config.ts Show resolved Hide resolved
packages/cloudflare/package.json Show resolved Hide resolved
examples/middleware/package.json Outdated Show resolved Hide resolved
examples/middleware/package.json Outdated Show resolved Hide resolved
examples/middleware/e2e/playwright.config.ts Outdated Show resolved Hide resolved
/* Run your local dev server before starting the tests */
webServer: {
command: "pnpm preview:worker",
url: "http://localhost:8770",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url: "http://localhost:8770",
url: "http://localhost:8774",

packages/cloudflare/src/cli/build/index.ts Show resolved Hide resolved
packages/cloudflare/README.md Show resolved Hide resolved
examples/middleware/e2e/base.spec.ts Outdated Show resolved Hide resolved
vicb and others added 3 commits November 1, 2024 09:39
Update examples/middleware/package.json

Co-authored-by: James Anderson <[email protected]>
@@ -3,5 +3,6 @@ node_modules

output
.worker-next
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we remove .worker-next if it's not used anymore?

examples/create-next-app/tsconfig.json Show resolved Hide resolved
examples/middleware/package.json Outdated Show resolved Hide resolved
packages/cloudflare/src/cli/build/build-next-app.ts Outdated Show resolved Hide resolved
Comment on lines +9 to +31
## Deploy your own

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/middleware&project-name=middleware&repository-name=middleware)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:

```bash
npx create-next-app --example middleware middleware-app
```

```bash
yarn create next-app --example middleware middleware-app
```

```bash
pnpm create next-app --example middleware middleware-app
```

Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Deploy your own
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/middleware&project-name=middleware&repository-name=middleware)
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
```bash
npx create-next-app --example middleware middleware-app
```
```bash
yarn create next-app --example middleware middleware-app
```
```bash
pnpm create next-app --example middleware middleware-app
```
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the changes here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just removing the vercel specific documentation

Copy link
Contributor

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🙂

It's very cool and promising seeing the integration with ona 🤩 🚀

@vicb
Copy link
Contributor Author

vicb commented Nov 4, 2024

Thanks for the reviews and the approval @dario-piotrowicz.

As you noted there are still a few rough edges but they will be solved as the integration progresses - and I think those are ok in the experimental branch.

My plan is to merge this PR and then push the changes to the experimental branch so that it's easier for users to install and test the package.

@vicb vicb merged commit dd5b64e into merge-open-next Nov 4, 2024
@vicb vicb deleted the open-next branch November 4, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants