Skip to content

Commit c408dd1

Browse files
Gaurav0runspired
authored andcommitted
[BUGFIX RELEASE BETA CANARY] Better fastboot crypto error message (#6699)
1 parent 31f6aff commit c408dd1

File tree

1 file changed

+7
-1
lines changed
  • packages/store/addon/-private/identifiers/utils

1 file changed

+7
-1
lines changed

packages/store/addon/-private/identifiers/utils/uuid-v4.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ const CRYPTO = (() => {
1616
if (isFastBoot) {
1717
return {
1818
getRandomValues(buffer: Uint8Array) {
19-
return (FastBoot as FastBoot).require('crypto').randomFillSync(buffer);
19+
try {
20+
return (FastBoot as FastBoot).require('crypto').randomFillSync(buffer);
21+
} catch (err) {
22+
throw new Error(
23+
'Using createRecord in Fastboot requires you to add the "crypto" package to "fastbootDependencies" in your package.json'
24+
);
25+
}
2026
},
2127
};
2228
} else if (hasWindow && typeof window.crypto !== 'undefined') {

0 commit comments

Comments
 (0)