opennextjs / opennextjs-aws

Open-source Next.js adapter for AWS
https://opennext.js.org
MIT License
4.14k stars 126 forks source link

chore: upgrade examples to next 15 and fix e2e test #588

Closed sommeeeer closed 3 weeks ago

sommeeeer commented 3 weeks ago

This PR will be in draft mode. Trying to update all the apps in /examples to next 15 and fix the e2e test.

changeset-bot[bot] commented 3 weeks ago

⚠️ No Changeset found

Latest commit: 70bb0e1e20d0d36d8006b67261a224172e55bcf6

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

sommeeeer commented 3 weeks ago

Currently failing on this when i pnpm next build inside examples/app-router: Type error: 'Link' cannot be used as a JSX component.

khuezy commented 3 weeks ago

Can you try reverting the changes to:

    "@types/react": "npm:types-react@19.0.0-rc.1",
    "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",

I'm using the 18.x "@types" in my app and it doesn't complain.

sommeeeer commented 3 weeks ago

Not able to build pages-router after upgrading to next 15. I have tried both 19 and 18 for @types/*

conico974 commented 3 weeks ago

@sommeeeer There is an issue with the lockfile https://github.com/opennextjs/opennextjs-aws/actions/runs/11466288277/job/31906625766?pr=588 Also it doesn't look like a typing issueCheck validity of types did succeed. Most likely it cannot find the correct version of react ( might be related to the lockfile issue )

sommeeeer commented 3 weeks ago

After installing next@latest in pages-router im running into this error: Error: Objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner, _store}). If you meant to render a collection of children, use an array instead. on /isr.

What happend with the validation? I would like to know if the lockfile is fine now.

For now im trying to stay on React 18 for pages-router. Next 15 should support it : https://nextjs.org/blog/next-15#pages-router-on-react-18

sommeeeer commented 3 weeks ago

So I think its using the wrong dependency for React for some reason. If this is related to pnpm im not sure yet. However, I found out that building with this command works: pnpm next build --experimental-build-mode compile

khuezy commented 3 weeks ago

--experimental-build-mode compile iirc, this flag prevents the prebuilding of the app.

sommeeeer commented 3 weeks ago

alright so im able to build every app now with pnpm next build. had to run the codemod on all the apps in /examples and on /example. choosing to upgrade react and react types to 19 aswell. after that i also had to update the react deps in example/shared. they all had to use the same react v (i.e 19)

i also changed the worldtimeapi to be timeapi instead. (worldtimeapi blocked me after a while)

sommeeeer commented 3 weeks ago

so i was able to run pnpm sst deploy --stage test in examples/sst now. the terminal hangs on this during app-pages-router:

image

if you just wait it will finish in the end, and you will get the deployed urls. as you can see the warning is probably coming from a peer dependency of sst which is ink. its used in sst/cli/deploy.js.

i fixed the e2e to work now and it passes 100%

pkg-pr-new[bot] commented 3 weeks ago

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/aws@588

commit: 70bb0e1

khuezy commented 3 weeks ago

yay thanks @sommeeeer !