diff --git a/.github/actions/load-verdaccio-with-amplify-js/action.yml b/.github/actions/load-verdaccio-with-amplify-js/action.yml index b0f2f5552ac..c8cd349cb86 100644 --- a/.github/actions/load-verdaccio-with-amplify-js/action.yml +++ b/.github/actions/load-verdaccio-with-amplify-js/action.yml @@ -6,8 +6,7 @@ runs: steps: - name: Start verdaccio run: | - # This version supports Node.js v22 - npx verdaccio@5.31.1 & + npx verdaccio@5.25.0 & while ! nc -z localhost 4873; do echo "Verdaccio not running yet" sleep 1 @@ -19,30 +18,25 @@ runs: - name: Install and run npm-cli-login shell: bash env: - NPM_REGISTRY_HOST: localhost:4873 - NPM_REGISTRY: http://localhost:4873 + NPM_REGISTRY: http://localhost:4873/ NPM_USER: verdaccio NPM_PASS: verdaccio NPM_EMAIL: verdaccio@amplify.js run: | - # Make the HTTP request that npm addUser makes to avoid the "Exit handler never called" error - TOKEN=$(curl -s \ - -H "Accept: application/json" \ - -H "Content-Type:application/json" \ - -X PUT --data "{\"name\": \"$NPM_USER\", \"password\": \"$NPM_PASS\", \"email\": \"$NPM_EMAIL\"}" \ - $NPM_REGISTRY/-/user/org.couchdb.user:$NPM_USER 2>&1 | jq -r '.token') - - # Set the Verdaccio registry and set the token for logging in - yarn config set registry $NPM_REGISTRY - npm set registry $NPM_REGISTRY - npm set //"$NPM_REGISTRY_HOST"/:_authToken $TOKEN - - name: Configure git + npm i -g npm-cli-adduser + npm-cli-adduser + sleep 1 + - name: Configure registry and git shell: bash working-directory: ./amplify-js env: + NPM_REGISTRY: http://localhost:4873/ NPM_USER: verdaccio + NPM_PASS: verdaccio NPM_EMAIL: verdaccio@amplify.js run: | + yarn config set registry $NPM_REGISTRY + npm set registry $NPM_REGISTRY git config --global user.email $NPM_EMAIL git config --global user.name $NPM_USER git status diff --git a/.github/actions/node-and-build/action.yml b/.github/actions/node-and-build/action.yml index becd2d49165..0af092c4c84 100644 --- a/.github/actions/node-and-build/action.yml +++ b/.github/actions/node-and-build/action.yml @@ -4,15 +4,13 @@ inputs: is-prebuild: required: false default: false - node_version: - required: false runs: using: 'composite' steps: - - name: Setup Node.js + - name: Setup Node.js 18 uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 with: - node-version: ${{ inputs.node_version || '18.x' }} + node-version: 18.20.2 env: SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2 - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 diff --git a/.github/integ-config/integ-all.yml b/.github/integ-config/integ-all.yml index db7f9d64444..d29ae41ba42 100644 --- a/.github/integ-config/integ-all.yml +++ b/.github/integ-config/integ-all.yml @@ -829,7 +829,7 @@ tests: sample_name: [guest-access] spec: storage-client-server browser: *minimal_browser_list - + # INAPPMESSAGING - test_name: integ_in_app_messaging desc: 'React InApp Messaging' @@ -856,10 +856,3 @@ tests: spec: ssr-context-isolation yarn_script: ci:ssr-context-isolation browser: [chrome] - - test_name: integ_node_envs - desc: 'Node.js environment tests' - framework: node - category: integration - sample_name: auth-gql-storage - yarn_script: ci:node-env-test - node_versions: ['18.x', '20.x', '22.x'] diff --git a/.github/workflows/callable-e2e-test.yml b/.github/workflows/callable-e2e-test.yml index fd9f9cb697a..18697cf5dc5 100644 --- a/.github/workflows/callable-e2e-test.yml +++ b/.github/workflows/callable-e2e-test.yml @@ -37,9 +37,6 @@ on: yarn_script: required: false type: string - node_versions: - required: false - type: string env: AMPLIFY_DIR: /home/runner/work/amplify-js/amplify-js/amplify-js @@ -57,8 +54,6 @@ jobs: - ${{ fromJson(inputs.browser) }} sample_name: - ${{ fromJson(inputs.sample_name) }} - node_version: - - ${{ fromJson(inputs.node_versions) }} fail-fast: false timeout-minutes: ${{ inputs.timeout_minutes }} @@ -69,8 +64,6 @@ jobs: path: amplify-js - name: Setup node and build the repository uses: ./amplify-js/.github/actions/node-and-build - with: - node_version: ${{ matrix.node_version }} - name: Setup samples staging repository uses: ./amplify-js/.github/actions/setup-samples-staging with: diff --git a/.github/workflows/callable-e2e-tests.yml b/.github/workflows/callable-e2e-tests.yml index 15f6b576f8d..c27c51ce57f 100644 --- a/.github/workflows/callable-e2e-tests.yml +++ b/.github/workflows/callable-e2e-tests.yml @@ -44,7 +44,6 @@ jobs: timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }} retry_count: ${{ matrix.integ-config.retry_count || 3 }} yarn_script: ${{ matrix.integ-config.yarn_script || '' }} - node_versions: ${{ toJSON(matrix.integ-config.node_versions) || '[""]' }} # e2e-test-runner-headless: # name: E2E test runnner_headless diff --git a/package.json b/package.json index eef6052f3e7..06a17c0fdaf 100644 --- a/package.json +++ b/package.json @@ -130,9 +130,6 @@ "webpack-bundle-analyzer": "^4.7.0", "webpack-cli": "^5.0.0" }, - "engines": { - "node": ">=18" - }, "resolutions": { "@types/babel__traverse": "7.20.0", "path-scurry": "1.10.0", diff --git a/packages/aws-amplify/package.json b/packages/aws-amplify/package.json index bd2e711ad49..f10ee23cf22 100644 --- a/packages/aws-amplify/package.json +++ b/packages/aws-amplify/package.json @@ -383,7 +383,7 @@ "name": "[Auth] confirmSignIn (Cognito)", "path": "./dist/esm/auth/index.mjs", "import": "{ confirmSignIn }", - "limit": "28.30 kB" + "limit": "28.27 kB" }, { "name": "[Auth] updateMFAPreference (Cognito)", @@ -449,13 +449,13 @@ "name": "[Auth] Basic Auth Flow (Cognito)", "path": "./dist/esm/auth/index.mjs", "import": "{ signIn, signOut, fetchAuthSession, confirmSignIn }", - "limit": "30.10 kB" + "limit": "30.06 kB" }, { "name": "[Auth] OAuth Auth Flow (Cognito)", "path": "./dist/esm/auth/index.mjs", "import": "{ signInWithRedirect, signOut, fetchAuthSession }", - "limit": "21.50 kB" + "limit": "21.47 kB" }, { "name": "[Storage] copy (S3)", diff --git a/packages/core/__tests__/utils/globalHelpers/globalHelpers.test.ts b/packages/core/__tests__/utils/globalHelpers/globalHelpers.test.ts index bb7d2e39a9b..4d9dbd8bc17 100644 --- a/packages/core/__tests__/utils/globalHelpers/globalHelpers.test.ts +++ b/packages/core/__tests__/utils/globalHelpers/globalHelpers.test.ts @@ -44,6 +44,12 @@ describe('getGlobal', () => { expect(getCrypto()).toEqual(mockCrypto); }); + + it('should throw error if crypto is unavailable globally', () => { + mockWindow.mockImplementation(() => undefined); + + expect(() => getCrypto()).toThrow(AmplifyError); + }); }); describe('getBtoa()', () => { diff --git a/packages/core/src/utils/globalHelpers/index.ts b/packages/core/src/utils/globalHelpers/index.ts index dc35f897bf6..622f4d3c3ef 100644 --- a/packages/core/src/utils/globalHelpers/index.ts +++ b/packages/core/src/utils/globalHelpers/index.ts @@ -13,16 +13,6 @@ export const getCrypto = () => { return crypto; } - try { - const crypto = require('node:crypto').webcrypto; - - if (typeof crypto === 'object') { - return crypto; - } - } catch (_) { - // no-op - } - throw new AmplifyError({ name: 'MissingPolyfill', message: 'Cannot resolve the `crypto` function from the environment.',