Skip to content

Commit

Permalink
[BUGFIX RELEASE BETA CANARY] Better fastboot crypto error message (#6692
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Gaurav0 authored and runspired committed Nov 7, 2019
1 parent c84a06d commit c07cee0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/store/addon/-private/identifiers/utils/uuid-v4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ const CRYPTO = (() => {
if (isFastBoot) {
return {
getRandomValues(buffer: Uint8Array) {
return (FastBoot as FastBoot).require('crypto').randomFillSync(buffer);
try {
return (FastBoot as FastBoot).require('crypto').randomFillSync(buffer);
} catch (err) {
throw new Error(
'Using createRecord in Fastboot requires you to add the "crypto" package to "fastbootDependencies" in your package.json'
);
}
},
};
} else if (hasWindow && typeof window.crypto !== 'undefined') {
Expand Down

0 comments on commit c07cee0

Please sign in to comment.