cloudinary / cloudinary_angular

Cloudinary Angular client library
MIT License
305 stars 228 forks source link

ERROR ReferenceError: MutationObserver is not defined at CloudinaryImage.ngOnInit #294

Closed rahul-rajabhoj closed 3 years ago

rahul-rajabhoj commented 3 years ago

ERROR ReferenceError: MutationObserver is not defined at CloudinaryImage.ngOnInit

Facing above error with below version of Cloudinary with Angular 10 SSR (Server Side Rendering)

"@angular/core": "~10.0.0", "@cloudinary/angular-5.x": "^1.3.3", "cloudinary-core": "^2.11.3", "@nguniversal/express-engine": "^10.0.2"

node v12.18.1 nvm 6.14.5

Bug Description

After adding cloudinary angular sdk to Angular 10 SSR enabled project, got the below error when tested with "ng run ssr:serve-ssr" script.

ERROR ReferenceError: MutationObserver is not defined at CloudinaryImage.ngOnInit (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:50280:33) at callHook (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:118441:18) at callHooks (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:118411:17) at executeInitAndCheckHooks (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:118363:9) at refreshView (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:122590:21) at refreshEmbeddedViews (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:123683:17) at refreshView (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:122599:9) at refreshComponent (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:123729:13) at refreshChildComponents (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:122368:9) at refreshView (/Users/rahulrajabhoj/ssr/dist/ssr/server/main.js:122625:13) `

roeeba commented 3 years ago

Hi @rahul-rajabhoj. Thank you for pointing this out. Would you mind sharing your code so we can take a closer look at it and try to reproduce it on our end?

roeeba commented 3 years ago

@rahul-rajabhoj You might also want to check our angular-universal sample at https://github.com/cloudinary/cloudinary_angular/tree/master/projects/angular-cld/samples/angular-universal-sample (you’ll need to update package.json with "@types/node”: “7.0.7")

roeeba commented 3 years ago

Closing this issue due to the time elapsed. Please feel free to either re-open the issue, contact our support at http://support.cloudinary.com, or create a new ticket if you have any additional issues.

r3plica commented 3 years ago

I wish you hadn't closed this. I am having the issue too

patrick-tolosa commented 3 years ago

@r3plica can you please open a fresh issue with your use case?

r3plica commented 3 years ago

will do and I figured out what is causing it :(