Skip to content

Commit 953d578

Browse files
committed
Revert "Reapply "feat(core): resolve webcrypto from node:crypto for Node18 (#13599)" (#13775)"
This reverts commit 1fea052.
1 parent e617786 commit 953d578

File tree

8 files changed

+18
-48
lines changed

8 files changed

+18
-48
lines changed

.github/actions/load-verdaccio-with-amplify-js/action.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ runs:
66
steps:
77
- name: Start verdaccio
88
run: |
9-
# This version supports Node.js v22
10-
9+
1110
while ! nc -z localhost 4873; do
1211
echo "Verdaccio not running yet"
1312
sleep 1
@@ -19,30 +18,25 @@ runs:
1918
- name: Install and run npm-cli-login
2019
shell: bash
2120
env:
22-
NPM_REGISTRY_HOST: localhost:4873
23-
NPM_REGISTRY: http://localhost:4873
21+
NPM_REGISTRY: http://localhost:4873/
2422
NPM_USER: verdaccio
2523
NPM_PASS: verdaccio
2624
NPM_EMAIL: [email protected]
2725
run: |
28-
# Make the HTTP request that npm addUser makes to avoid the "Exit handler never called" error
29-
TOKEN=$(curl -s \
30-
-H "Accept: application/json" \
31-
-H "Content-Type:application/json" \
32-
-X PUT --data "{\"name\": \"$NPM_USER\", \"password\": \"$NPM_PASS\", \"email\": \"$NPM_EMAIL\"}" \
33-
$NPM_REGISTRY/-/user/org.couchdb.user:$NPM_USER 2>&1 | jq -r '.token')
34-
35-
# Set the Verdaccio registry and set the token for logging in
36-
yarn config set registry $NPM_REGISTRY
37-
npm set registry $NPM_REGISTRY
38-
npm set //"$NPM_REGISTRY_HOST"/:_authToken $TOKEN
39-
- name: Configure git
26+
npm i -g npm-cli-adduser
27+
npm-cli-adduser
28+
sleep 1
29+
- name: Configure registry and git
4030
shell: bash
4131
working-directory: ./amplify-js
4232
env:
33+
NPM_REGISTRY: http://localhost:4873/
4334
NPM_USER: verdaccio
35+
NPM_PASS: verdaccio
4436
NPM_EMAIL: [email protected]
4537
run: |
38+
yarn config set registry $NPM_REGISTRY
39+
npm set registry $NPM_REGISTRY
4640
git config --global user.email $NPM_EMAIL
4741
git config --global user.name $NPM_USER
4842
git status

.github/actions/node-and-build/action.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ inputs:
44
is-prebuild:
55
required: false
66
default: false
7-
node_version:
8-
required: false
97
runs:
108
using: 'composite'
119
steps:
12-
- name: Setup Node.js
10+
- name: Setup Node.js 18
1311
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
1412
with:
15-
node-version: ${{ inputs.node_version || '18.x' }}
13+
node-version: 18.20.2
1614
env:
1715
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
1816
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0

.github/integ-config/integ-all.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -870,10 +870,3 @@ tests:
870870
spec: ssr-context-isolation
871871
yarn_script: ci:ssr-context-isolation
872872
browser: [chrome]
873-
- test_name: integ_node_envs
874-
desc: 'Node.js environment tests'
875-
framework: node
876-
category: integration
877-
sample_name: auth-gql-storage
878-
yarn_script: ci:node-env-test
879-
node_versions: ['18.x', '20.x', '22.x']

.github/workflows/callable-e2e-test.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ on:
3737
yarn_script:
3838
required: false
3939
type: string
40-
node_versions:
41-
required: false
42-
type: string
4340

4441
env:
4542
AMPLIFY_DIR: /home/runner/work/amplify-js/amplify-js/amplify-js
@@ -57,8 +54,6 @@ jobs:
5754
- ${{ fromJson(inputs.browser) }}
5855
sample_name:
5956
- ${{ fromJson(inputs.sample_name) }}
60-
node_version:
61-
- ${{ fromJson(inputs.node_versions) }}
6257
fail-fast: false
6358
timeout-minutes: ${{ inputs.timeout_minutes }}
6459

@@ -69,8 +64,6 @@ jobs:
6964
path: amplify-js
7065
- name: Setup node and build the repository
7166
uses: ./amplify-js/.github/actions/node-and-build
72-
with:
73-
node_version: ${{ matrix.node_version }}
7467
- name: Setup samples staging repository
7568
uses: ./amplify-js/.github/actions/setup-samples-staging
7669
with:

.github/workflows/callable-e2e-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ jobs:
4444
timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }}
4545
retry_count: ${{ matrix.integ-config.retry_count || 3 }}
4646
yarn_script: ${{ matrix.integ-config.yarn_script || '' }}
47-
node_versions: ${{ toJSON(matrix.integ-config.node_versions) || '[""]' }}
4847

4948
# e2e-test-runner-headless:
5049
# name: E2E test runnner_headless

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@
130130
"webpack-bundle-analyzer": "^4.7.0",
131131
"webpack-cli": "^5.0.0"
132132
},
133-
"engines": {
134-
"node": ">=18"
135-
},
136133
"resolutions": {
137134
"@types/babel__traverse": "7.20.0",
138135
"path-scurry": "1.10.0",

packages/core/__tests__/utils/globalHelpers/globalHelpers.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ describe('getGlobal', () => {
4444

4545
expect(getCrypto()).toEqual(mockCrypto);
4646
});
47+
48+
it('should throw error if crypto is unavailable globally', () => {
49+
mockWindow.mockImplementation(() => undefined);
50+
51+
expect(() => getCrypto()).toThrow(AmplifyError);
52+
});
4753
});
4854

4955
describe('getBtoa()', () => {

packages/core/src/utils/globalHelpers/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ export const getCrypto = () => {
1313
return crypto;
1414
}
1515

16-
try {
17-
const crypto = require('node:crypto').webcrypto;
18-
19-
if (typeof crypto === 'object') {
20-
return crypto;
21-
}
22-
} catch (_) {
23-
// no-op
24-
}
25-
2616
throw new AmplifyError({
2717
name: 'MissingPolyfill',
2818
message: 'Cannot resolve the `crypto` function from the environment.',

0 commit comments

Comments
 (0)