-
Notifications
You must be signed in to change notification settings - Fork 211
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
Failing in web client projects due to NodeJS usage without polyfills. #156
Comments
Can you provide more info on how you are importing this library? I noticed that your error comes from |
@vlad-ignatov Just |
I see. It does appear to be a bug. I can start working on it tomorrow. Meanwhile, perhaps the only fix for you (other than using a bundle via script tag) would be to add |
Much appreciated! I'm happy to help test. -Preston |
I think I might be close to releasing a fix in the next version. Before I do that, it would be great if you can test and verify that your issue is solved. To do so: npm rm fhirclient
npm i https://github.com/smart-on-fhir/client-js.git |
I think this is it: client-js/src/security/browser.ts Line 3 in 0861c6f
|
Oh, yes. This is a hack needed for testing only. We use the native Crypto, or msCrypto in IE11 via "isomorphic-webcrypto". This line just allows tests to "inject" the NodeJS Crypto in there, because JsDOM does not have one... I have pushed a fix for that: afab420#diff-b5c64cf5995872585d4cb25310e8720be856fce951df0ca1a260b12dddc8808cR4-R6 |
I haven't extensively tested it, but am at least getting through the initial SMART launch redirect by FHIR.oauth2.authorize(..) now. :) |
Same issue, ./node_modules/fhirclient/lib/security/server.js:14:15-32 - Error: Module not found: Error: Can't resolve 'crypto' in '/apps/healthunitysmartauth/node_modules/fhirclient/lib/security'
|
The fix should now be released in |
Working now. Thanks! |
When serving an angular app (via embedded EHR launch) from http://localhost:4200/... in Chrome 110.0.5481.177, I get: This causes digestSha256 in browser.js(37) to fail. I suggest broadening the test in browser.js(10) to include a test for globalThis.crypto.subtle === undefined. |
I'm updating an Angular 14 app which uses webpack 5. Older versions of webpack had included polyfills for NodeJS functions by default. Now that this is no longer the case, fhirclient seems to break immediately due to Node functions being missing. Below is the error. Anyone using a client-side webapp framework that does not include Node polyfills should be getting this error.
The text was updated successfully, but these errors were encountered: