@aws-amplify/datastore potentially uses the wrong version of tslib and errors out
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
Vue
Amplify APIs
Authentication
Amplify Version
v5
Amplify Categories
auth
Backend
None
Environment information
System:
OS: macOS 26.5.2
CPU: (10) arm64 Apple M5
Memory: 165.92 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.22.3 - /Users/work/.nvm/versions/node/v22.22.3/bin/node
npm: 10.9.8 - /Users/work/.nvm/versions/node/v22.22.3/bin/npm
Browsers:
Chrome: 148.0.7778.216
Firefox Developer Edition: 153.0
Safari: 26.5.2
Safari Technology Preview: 26.0
npmPackages:
@aws-amplify/ui-vue: ^3.1.30 => 3.1.30
@tsconfig/node24: ^24.0.4 => 24.0.4
@types/node: ^24.13.2 => 24.13.2
@vitejs/plugin-vue: ^6.0.7 => 6.0.7
@vue/tsconfig: ^0.9.1 => 0.9.1 (0.1.3)
apollo-boost: ^0.4.9 => 0.4.9
aws-amplify: ^5.3.29 => 5.3.37
npm-run-all2: ^9.0.2 => 9.0.2
typescript: ~6.0.0 => 6.0.3
vite: ^7.3.6 => 7.3.6
vite-plugin-vue-devtools: ^8.1.2 => 8.1.5
vue: ^3.5.38 => 3.5.39
vue-tsc: ^3.3.5 => 3.3.6
npmGlobalPackages:
corepack: 0.34.6
npm: 10.9.8Describe the bug
In a project, I've included an old version of apollo-boost, that we've used for ~ 6 years to handle our GraphQL queries (to AppSync, no less). A recent version of aws-amplify, v5.3.37, has caused the application to throw errors immediately when using a dev server via Vite.
Expected behavior
The dev server should work correctly.
Reproduction steps
A minimal reproduction can be found here: https://github.com/methompson/amplify_bug
Steps to reproduce:
- Install dependencies with
npm ci - Run the dev server with
npm run dev
You should observe several errors in the terminal.
Code Snippet
Literally importing from aws-amplify causes the project to error out:
import { Amplify, Auth, Hub, I18n } from "aws-amplify";Log output
✘ [ERROR] No matching export in "node_modules/@aws-amplify/datastore/node_modules/tslib/tslib.es6.js" for import "__spreadArray"
node_modules/@aws-amplify/datastore/lib-esm/util.js:1:51:
1 │ ...aiter, __generator, __read, __spreadArray, __values } from "tslib";
│ ~~~~~~~~~~~~~
╵ __spreadArrays
Did you mean to import "__spreadArrays" instead?
node_modules/@aws-amplify/datastore/node_modules/tslib/tslib.es6.js:150:16:
150 │ export function __spreadArrays() {
╵ ~~~~~~~~~~~~~~
at failureErrorWithLog (/Users/work/Desktop/work/amplify_bug/node_modules/esbuild/lib/main.js:1748:15)
at /Users/work/Desktop/work/amplify_bug/node_modules/esbuild/lib/main.js:1207:25
at /Users/work/Desktop/work/amplify_bug/node_modules/esbuild/lib/main.js:1626:9
at process.processTicksAndRejections (node:internal/process/task_queues:103:5) {
errors: [Getter/Setter],
warnings: [Getter/Setter]
}aws-exports.js
N/A
Manual configuration
N/A
Additional configuration
N/A
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
I note that the version of tslib installed in node_modules/@aws-amplify/datastore/node_modules/tslib is v1.14.1. I also note that __spreadArray only became a part of the tslib package as of 2.1.0.
This project works fine if aws-amplify v5.3.35 is installed: npm i [email protected].
If I remove the apollo-boost dependency from package.json, then remove node_modules and reinstall, the project functions correctly.
i.e.
rm -rf node_modules package-lock.json && npm iI imagine specifying a minimum version of tslib v2.1.0 for the @aws-amplify/datastore project would resolve this issue.
Source: aws-amplify/amplify-js