Skip to content

[BUG] Formio throws error while running SSR build #1074

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
1 task done
rishi-soul opened this issue Apr 23, 2024 · 1 comment
Closed
1 task done

[BUG] Formio throws error while running SSR build #1074

rishi-soul opened this issue Apr 23, 2024 · 1 comment
Labels

Comments

@rishi-soul
Copy link

Environment

Local Build

  • Hosting type
    • Form.io
    • [ x] Local deployment
  • Formio.js version:^4.18.0
  • Frontend framework: Angular 16

Steps to Reproduce

  1. ng run sr-front:serve-ssr:local

Observed behavior

./node_modules/formiojs/providers/storage/s3.js:54
var AbortController = window.AbortController || require('abortcontroller-polyfill/dist/cjs-ponyfill');
^

ReferenceError: window is not defined
at Object.29290 (./node_modules/formiojs/providers/storage/s3.js:54:23)
at require (./webpack/bootstrap:19:1)
at Object.83889 (./node_modules/formiojs/providers/storage/index.js:9:33)
at require (./webpack/bootstrap:19:1)
at Object.52573 (./node_modules/formiojs/providers/Providers.js:21:39)
at require (./webpack/bootstrap:19:1)
at Object.73119 (./node_modules/formiojs/providers/index.js:8:41)
at require (./webpack/bootstrap:19:1)
at Object.36673 (./node_modules/formiojs/Formio.js:47:41)
at webpack_require (./webpack/bootstrap:19:1)

Node.js v20.12.1
A server error has occurred.
node exited with 1 code.

Observation:
This generally happens with any third party library if window code is not protected. Any ssr build will throw an reference error.

@rishi-soul rishi-soul added the bug label Apr 23, 2024
@lane-formio
Copy link
Contributor

This is expected, currently @formio/js is not compatible with SSR.

@lane-formio lane-formio closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants