Skip to content

Commit

Permalink
add remedation instructions to the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
anagstef committed Dec 16, 2024
1 parent 9de3e49 commit 8790167
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/shared/src/__tests__/keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ describe('parsePublishableKey(key)', () => {
});

it('throws an error if the publishable key is missing, when fatal: true', () => {
expect(() => parsePublishableKey(undefined, { fatal: true })).toThrowError('Publishable key is missing.');
expect(() => parsePublishableKey(undefined, { fatal: true })).toThrowError(
'Publishable key is missing. Ensure that your publishable key is correctly configured. Make sure to double-check your environment configuration (.env file).',
);
});

it('applies the proxyUrl if provided', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/shared/src/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export function parsePublishableKey(

if (!key || !isPublishableKey(key)) {
if (options.fatal && !key) {
throw new Error('Publishable key is missing.');
throw new Error(
'Publishable key is missing. Ensure that your publishable key is correctly configured. Make sure to double-check your environment configuration (.env file).',
);
}
if (options.fatal && !isPublishableKey(key)) {
throw new Error('Publishable key not valid.');
Expand Down

0 comments on commit 8790167

Please sign in to comment.