Skip to content

fix angular19 #277

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

Merged
merged 4 commits into from
Nov 22, 2024
Merged

fix angular19 #277

merged 4 commits into from
Nov 22, 2024

Conversation

Yuangwang
Copy link
Collaborator

Add additional support for prerendered object routes

@jamesdaniels
Copy link
Collaborator

q, are we using that object? if so maybe we limit our validation to the keys/values we care about

@Yuangwang
Copy link
Collaborator Author

Good point, we don't actually use prerendered routes at all so its better to remove it.

@@ -63,5 +63,4 @@ export const buildManifestSchema = z.object({
server: z.optional(url),
browser: url,
}),
prerenderedRoutes: z.optional(z.string().array()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think we can comment this out for now and add that the type is different between v19 and v18? Might be helpful later when we actually end up using this field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@Yuangwang Yuangwang merged commit a139fe6 into main Nov 22, 2024
10 checks passed
@quedicesebas
Copy link

quedicesebas commented Nov 26, 2024

Not working for me, I'm getting errors as soon as upgrade my project to Angular 19:

2024-11-26 12:08:21.733 EST
Step #2 - "pack": errors: [
Step #2 - "pack": {
Step #2 - "pack": code: 'invalid_type',
Step #2 - "pack": expected: 'array',
Step #2 - "pack": received: 'object',
Step #2 - "pack": path: [ 'prerenderedRoutes' ],
Step #2 - "pack": message: 'Expected array, received object'
Step #2 - "pack": }
Step #2 - "pack": ]
Step #2 - "pack": }

I think this line must be changed, adding the object type, or removed or something: https://github.com/FirebaseExtended/firebase-framework-tools/blob/a139fe6a2681db20797df0c8a05cb2ba764f05e3/packages/%40apphosting/adapter-angular/src/interface.ts#L38C3-L38C44

I made a PR #279

@taeold
Copy link
Collaborator

taeold commented Nov 27, 2024

@quedicesebas Sorry for the troubles. The fix needs to be rolled out to our servers, which should take sometime (ETA: first week of December).

In the meantime, we'll try to see if we can create a workaround to get angular19 working on app hosting.

@quedicesebas
Copy link

quedicesebas commented Nov 27, 2024

I already lost 3 days with this, now I had made a rollback of the migration, so how much time more :( Did you saw my PR?

@Yuangwang
Copy link
Collaborator Author

@quedicesebas and anyone else having this issue. We'll keep y'all posted on when this fix goes live. Until then please give this workaround a try:

Step 1:
In your project run npm install @apphosting/[email protected], this will install the latest adapter with this fix merged in.
After running that please verify that you see @apphosting/adapter-angular": "^17.2.11 in your package.json. Its important that the version is 17.2.11 since this fix is released with that version.

Step 2:
Add this additional line in your package.json scripts: "apphosting:build": "FRAMEWORK_VERSION=${YOUR_ANGULAR_VERSION} apphosting-adapter-angular-build"

Step 3:
Commit these changes to github and kickoff a new rollout

@quedicesebas
Copy link

In the step 2, shouel be "apphosting:build": "FRAMEWORK_VERSION=19.0.0 apphosting-adapter-angular-build" for example?

@Yuangwang
Copy link
Collaborator Author

yeah thats right, give it a try and lmk if it fixes your issues

@quedicesebas
Copy link

Worked!

@Char2sGu
Copy link
Contributor

Char2sGu commented Dec 6, 2024

The @apphosting/adapter-angular depends on some outdated version of angular devkit packages.

The below dependency overrides are required to install the given version of @apphosting/adapter-angular:

    "@apphosting/adapter-angular": {
      "@angular-devkit/architect": "$@angular-devkit/architect",
      "@angular-devkit/core": "$@angular-devkit/core"
    }

A >= semver matcher might increase the compatibility @Yuangwang

@Char2sGu
Copy link
Contributor

Char2sGu commented Dec 6, 2024

Another thing worth notice is that after installing @apphosting/[email protected],
dependencies are installed with NODE_ENV set to production,
while previously it was development.

If there are any npm "prepare" scripts, e.g. husky install, this change might cause another build error since the binary will not be installed in production.

EDIT: It seems that NODE_ENV=development is still used, but some builds uses NODE_ENV=production and causes the build to fail when I was debugging. I'm not sure what specifically triggered the change, but it first happens when I install the adapter as a dev dependency.

@quedicesebas
Copy link

For Angular v19, we still need to set the npm task "apphosting:build": "FRAMEWORK_VERSION=19.0.0 apphosting-adapter-angular-build"?
Also, we still need to set:

"engines": {
    "node": "^20.11.1"
  }

???

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.

5 participants