amplify-backend
amplify-backend copied to clipboard
add check to `@aws-amplify/backend` to throw early in a browser context
Problem
when folks attempt to use this in client-side applications they receive a cryptic error
Error: Can't resolve 'crypto' in '/Users/josef/my-amplify-app/node_modules/@aws-amplify/backend/lib'
Issue number, if available:
Changes
This PR introduces an early check for browser globals and throws early if they're available.
I considered splitting this out into its own utility and tested outside the context of the secret utility, or lifting to the entrypoint of @aws-amplify/backend to prohibit use of any infra-related APIs client-side.
Corresponding docs PR, if applicable:
Validation
added tests
Checklist
- [x] If this PR includes a functional change to the runtime behavior of the code, I have added or updated automated test coverage for this change.
- [ ] If this PR requires a change to the Project Architecture README, I have included that update in this PR.
- [ ] If this PR requires a docs update, I have linked to that docs PR above.
- [ ] If this PR modifies E2E tests, makes changes to resource provisioning, or makes SDK calls, I have run the PR checks with the
run-e2elabel set.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
🦋 Changeset detected
Latest commit: 86874186d5215da251e34c8f5dc925aa5c0668a5
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @aws-amplify/backend | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR