Skip to content

Can't use normal Netlify functions when SSR enabled #114

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

Closed
srcn opened this issue May 27, 2024 · 1 comment · Fixed by #115
Closed

Can't use normal Netlify functions when SSR enabled #114

srcn opened this issue May 27, 2024 · 1 comment · Fixed by #115

Comments

@srcn
Copy link

srcn commented May 27, 2024

Describe the bug
When using the SSR runtime, normal Netlify (non-edge) functions are not working. Not sure if this is by design but I don't have this problem when using Next.js. Normal functions are working fine when using SSR in my Next.js apps.

angular-runtime/src/helpers/setUpEdgeFunction.js

excludedPath: ${JSON.stringify(excludedPaths)},

Shouldn't the excludedPath include .netlify and possible other internal URLs of Netlify?

Everything redirects back to the app itself. I figured that because even without any redirect rules, app works fine whereas without a /* /index.html 200 redirect, direct access to any url should result with the Netlify's internal 404 page which it does for the non-SSR version.

To Reproduce
Example repo with a clean Angular v18 installation with SSR enabled and a single function.

It's deployed at https://vermillion-cat-89e180.netlify.app/

The function is deployed at https://vermillion-cat-89e180.netlify.app/.netlify/functions/hello but accessing it would render the app with an Error on the console that says there is no Route for the url because Angular tries to render the url.

I tried adding redirect rules but since SSR apps are not subject to redirect rules, they don't solve the problem.

--

Example repo without SSR but with exact same setup with the SSR one; Angular v18 and a single function.

The function is deployed at https://stellar-horse-4fc8e6.netlify.app/.netlify/functions/hello and works fine.

Expected behavior
I should be able to trigger normal functions when using SSR. As a workaround, I'm currently using edge functions since the ones that are defined in netlify.toml file triggered before the runtime but they are not versioned like normal functions so they are not really a replacement for normal functions.

Versions

  • Angular: v18.0.0
  • plugin: Latest, auto installed from Netlify's dashboard

If you're using the CLI to build

  • OS: [e.g. macOS, Windows]
  • netlify/cli version:

If you're using file-based installation

  • netlify.toml:
@Skn0tt
Copy link
Contributor

Skn0tt commented May 27, 2024

Good catch! I'll work on a fix for this.

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 a pull request may close this issue.

2 participants