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

Angular 19, SSR, and the Angular Runtime #246

Closed
triadzack opened this issue Feb 5, 2025 · 4 comments · Fixed by #247
Closed

Angular 19, SSR, and the Angular Runtime #246

triadzack opened this issue Feb 5, 2025 · 4 comments · Fixed by #247
Labels

Comments

@triadzack
Copy link

triadzack commented Feb 5, 2025

Describe the bug
When I have the Angular runtime "active" in the Netlify UI build settings I get a TypeError: failBuild is not a function Error. When I remove the Angular runtime the App builds and is fine but SSR doesnt work and no edge functions are deployed.

To Reproduce
Steps to reproduce the behavior:

  1. Build in Netlfiy
  2. See error "Building ❯ Loading plugins" step

Expected behavior
Build to complete and deploy with edge functions

Versions

  • Angular: v19.0.3
  • plugin: v2.2.1
  • Node v20.18.1

netlify.toml: (have tried many iterations of this file. with/without the browser and with/without the redirects)

[build]
  command = "yarn build"
  functions = "netlify/functions"
  publish = "dist/jobs-marketplace/browser"

[[redirects]]
  from = "/*"
  status = 200
  to = "/index.csr.html"

Things I tried:

  • Remove the Angular runtime. It works but SSR seems turned off
  • Following the steps in the angular-19-on-netlify blog post.
  • Updates to my server.ts based on the This package's readme docs
  • Changes in my netlifiy.toml
  • Downgrading this plugin to v2.1.0

Here is the stacktrace for the error

 TypeError: failBuild is not a function
     at getProject (/opt/build/repo/node_modules/@netlify/angular-runtime/src/helpers/setUpEdgeFunction.js:30:14)
     at fixOutputDir (/opt/build/repo/node_modules/@netlify/angular-runtime/src/helpers/fixOutputDir.js:8:19)
 Failed during stage 'building site': Build script returned non-zero exit code: 4 (https://ntl.fyi/exit-code-4)
     at onPreBuild (/opt/build/repo/node_modules/@netlify/angular-runtime/src/index.js:32:11)
     at async file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/child/run.js:30:9
     at async handleEvent (file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/child/main.js:28:42)
     at async process.<anonymous> (file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/ipc.js:91:24)

I posted in more detail on the Netlify forms but considering this seems like it might be an issue with this package I would post and issue here.

@triadzack
Copy link
Author

triadzack commented Feb 5, 2025

I spent the morning looking over @netlify/angular-runtime source code here and it seems I had the 'ANGULAR_PROJECT' env var mis configured. That led me to another error I am working through.

But it still seems like there is a bug here. Why was failBuild not set? That likely would have outputted the correct error message for me to troubleshoot the problem.

@pieh
Copy link
Contributor

pieh commented Feb 6, 2025

That led me to another error I am working through.

Let's keep this issue about

TypeError: failBuild is not a function
     at getProject (/opt/build/repo/node_modules/@netlify/angular-runtime/src/helpers/setUpEdgeFunction.js:30:14)

error which I have prepared fix for.

If there are more actual bugs, please open separate issue about them (it's just much easier to track things this way)

But it still seems like there is a bug here. Why was failBuild not set? That likely would have outputted the correct error message for me to troubleshoot the problem.

Absolutely there is a bug. #247 is making changes to actually set failBuild in code paths that you shown.

@pieh pieh closed this as completed in #247 Feb 6, 2025
@linear linear bot reopened this Feb 6, 2025
@pieh
Copy link
Contributor

pieh commented Feb 6, 2025

Fix for

 TypeError: failBuild is not a function
     at getProject (/opt/build/repo/node_modules/@netlify/angular-runtime/src/helpers/setUpEdgeFunction.js:30:14)

errors hiding actual underlying problems was released in https://github.com/netlify/angular-runtime/releases/tag/v2.2.2

With that I'll close this issue. Please open new issues if

That led me to another error I am working through.

turns out to be @netlify/angular-runtime bug

@pieh pieh closed this as completed Feb 6, 2025
@triadzack
Copy link
Author

With that I'll close this issue. Please open new issues if

That led me to another error I am working through.

Yes thats the plan, sorry it that wasn't clear. I'm not sure its a @netlify/angular-runtime bug, if it turns out to be Ill post here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants