Amplify-js: Duplicate identifier 'Subscriber'

Created on 5 Nov 2019  ยท  16Comments  ยท  Source: aws-amplify/amplify-js

Am getting duplicate identifier subscriber issue from past 2 weeks.

error

Package.json.

{
  "name": "test",
  "version": "0.1.9",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "BUILD_ENV=${BUILD_ENV} ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json -w -s",
    "test": "karma start ./test-config/karma.conf.js",
    "test-ci": "karma start ./test-config/karma.conf.js --single-run",
    "test-coverage": "karma start ./test-config/karma.conf.js --coverage",
    "e2e": "npm run e2e-update && npm run e2e-test",
    "e2e-test": "protractor ./test-config/protractor.conf.js",
    "e2e-update": "webdriver-manager update --standalone false --gecko false"
  },
  "config": {
    "ionic_generate_source_map": "true"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/cdk": "^5.2.5",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/material": "^7.3.5",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/app-center-analytics": "^4.18.0",
    "@ionic-native/app-center-crashes": "^4.18.0",
    "@ionic-native/app-version": "^4.17.0",
    "@ionic-native/barcode-scanner": "^4.20.0",
    "@ionic-native/camera": "^4.17.0",
    "@ionic-native/code-push": "^4.20.0",
    "@ionic-native/core": "~4.15.0",
    "@ionic-native/device": "4.7.0",
    "@ionic-native/dialogs": "^4.17.0",
    "@ionic-native/file": "^4.20.0",
    "@ionic-native/image-picker": "^4.17.0",
    "@ionic-native/social-sharing": "^4.17.0",
    "@ionic-native/speech-recognition": "^4.17.0",
    "@ionic-native/splash-screen": "~4.15.0",
    "@ionic-native/status-bar": "~4.15.0",
    "@ionic/pro": "2.0.3",
    "@ionic/storage": "2.2.0",
    "apollo-client": "^2.6.2",
    "aws-amplify": "^1.2.4",
    "aws-amplify-angular": "^3.0.3",
    "aws-appsync": "^1.8.0",
    "cordova-android": "7.1.4",
    "cordova-android-play-services-gradle-release": "^2.0.0",
    "cordova-android-support-gradle-release": "^2.0.1",
    "cordova-browser": "5.0.4",
    "cordova-ios": "4.5.4",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-dialogs": "^2.0.1",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-ionic": "^5.3.0",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^2.2.5",
    "cordova-plugin-speechrecognition": "^1.2.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-telerik-imagepicker": "^2.2.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.4.3",
    "cordova-plugin-zip": "^3.1.0",
    "es6-promise-plugin": "^4.2.2",
    "font-awesome": "^4.7.0",
    "graphql-tag": "^2.10.1",
    "ionic-angular": "3.9.2",
    "ionic-long-press": "^1.5.0",
    "ionicons": "3.0.0",
    "ng2-translate": "^5.0.0",
    "phonegap-plugin-barcodescanner": "^8.0.1",
    "primeng": "^5.2.7",
    "rxjs": "5.5.11",
    "sentry-cordova": "^0.15.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@compodoc/compodoc": "^1.1.8",
    "@ionic/app-scripts": "3.2.2",
    "@types/jasmine": "^2.8.12",
    "@types/node": "^10.12.10",
    "angular2-template-loader": "^0.6.2",
    "html-loader": "^0.5.5",
    "istanbul-instrumenter-loader": "^3.0.1",
    "jasmine": "^2.99.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^3.1.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.4",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-webpack": "^3.0.5",
    "null-loader": "^0.1.1",
    "protractor": "^5.4.1",
    "ts-loader": "^3.5.0",
    "ts-node": "^7.0.1",
    "typescript": "3.3.3333",
    "webpack": "^3.12.0"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-speechrecognition": {},
      "cordova-plugin-dialogs": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-file": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-zip": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-telerik-imagepicker": {
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "Allow to access your gallery"
      },
      "cordova-plugin-x-socialsharing": {
        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
      },
      "cordova-plugin-appcenter-analytics": {},
      "cordova-plugin-appcenter-crashes": {},
      "cordova-android-play-services-gradle-release": {
        "PLAY_SERVICES_VERSION": "15.+"
      },
      "cordova-android-support-gradle-release": {
        "ANDROID_SUPPORT_VERSION": "27.+"
      },
      "cordova-plugin-code-push": {},
      "phonegap-plugin-barcodescanner": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-whitelist": {},
      "sentry-cordova": {}
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
}

We gone through https://github.com/aws-amplify/amplify-js/issues/3248 issue and updated the comment but i did't get any reply on that.

Ionic bug

Most helpful comment

after running npm ls @types/zen-observable I got

+-- @types/[email protected]
+-- [email protected]
| +-- @aws-amplify/[email protected]
| | `-- @types/[email protected]
| `-- @aws-amplify/[email protected]
|   `-- @types/[email protected]
`-- [email protected]
  +-- [email protected]
  | `-- @types/[email protected]  deduped
  `-- [email protected]
    `-- @types/[email protected]  deduped

Uninstalling the root @types/[email protected] doesn't fix this
I still receive
ERROR in node_modules/@aws-amplify/api/node_modules/@types/zen-observable/index.d.ts:32:14 - error TS2300: Duplicate identifier 'Subscriber'.

All 16 comments

Also getting this.

Edit: ran

> npm ls @types/zen-observable
[email protected] /Users/pbirsinger/consulting/lanehoney/top-lanes-report/client
โ”œโ”€โ”€ @types/[email protected]
โ””โ”€โ”ฌ [email protected]
  โ”œโ”€โ”ฌ @aws-amplify/[email protected]
  โ”‚ โ””โ”€โ”€ @types/[email protected]
  โ””โ”€โ”ฌ @aws-amplify/[email protected]
    โ””โ”€โ”€ @types/[email protected]

Then ran npm --save uninstall @types/zen-observable to fix. Not sure how that got there

after running npm ls @types/zen-observable I got

+-- @types/[email protected]
+-- [email protected]
| +-- @aws-amplify/[email protected]
| | `-- @types/[email protected]
| `-- @aws-amplify/[email protected]
|   `-- @types/[email protected]
`-- [email protected]
  +-- [email protected]
  | `-- @types/[email protected]  deduped
  `-- [email protected]
    `-- @types/[email protected]  deduped

Uninstalling the root @types/[email protected] doesn't fix this
I still receive
ERROR in node_modules/@aws-amplify/api/node_modules/@types/zen-observable/index.d.ts:32:14 - error TS2300: Duplicate identifier 'Subscriber'.

Hi,
Could you please add some more details such as how you have configured the app and the steps to reproduce the issue?

@Ashish5591

I ran npm ls@types/observables

image

Then ran npm --save uninstall @types/zen-observable but still am getting the same error(duplicate identifier subscriber).

Steps reproduce.
Create ionic app
Copy and replace the package.json from my previous comment.
Run ionic serve.

Then am getting the error.
image

Anyone have solution for the above issue? this is a blocker for me.

Having the same issue.
Is this a recurrence of #1732 ?

There's a temporary fix outlined in https://github.com/aws-amplify/amplify-js/issues/1732#issuecomment-450761829

@Birdstown Thanks for the response.

We are already gone through the https://github.com/aws-amplify/amplify-js/issues/1732#issuecomment-450761829 comment and tried but while generating the APK, this is not working.

Can someone help me out with this problem.

Also having this issue. Has anyone come across a better solution than the temporary fix from https://github.com/aws-amplify/amplify-js/issues/1732#issuecomment-450761829?

Also having this issue ... help. Are other people not having this issue? If not, please say so .. that would at least let me (us?) know to keep banging our head.

OK, I continued to bang my head and eventually things worked... I'm really not sure what the final solution was. But, it is now working without the 'Duplicate identifier Subscriber' error. Here is my package.json:

{ "name": "si-install-app", "version": "0.3.35", "author": "Sensor Industries", "homepage": "http://sensor-industries.com/", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/common": "^7.2.2", "@angular/core": "^7.2.2", "@angular/forms": "^7.2.2", "@angular/http": "^7.2.2", "@angular/platform-browser": "^7.2.2", "@angular/platform-browser-dynamic": "^7.2.2", "@angular/router": "^7.2.2", "@ionic-native/barcode-scanner": "5.0.0-beta.14", "@ionic-native/camera": "5.0.0-beta.14", "@ionic-native/core": "5.0.0-beta.14", "@ionic-native/file": "^5.2.0", "@ionic-native/file-path": "^5.2.0", "@ionic-native/file-transfer": "^5.2.0", "@ionic-native/ionic-webview": "^5.2.0", "@ionic-native/network": "^5.0.0-beta.14", "@ionic-native/splash-screen": "5.0.0-beta.14", "@ionic-native/status-bar": "5.0.0-beta.14", "@ionic/angular": "^4.8.0", "@ionic/angular-toolkit": "^2.0.0", "@ionic/storage": "^2.2.0", "angular-archwizard": "^5.0.0", "aws-amplify": "^1.2.4", "aws-appsync": "^3.0.2", "chart.js": "^2.7.2", "cordova-android": "^8.1.0", "cordova-browser": "5.0.4", "cordova-plugin-camera": "^4.0.3", "cordova-plugin-device": "^2.0.2", "cordova-plugin-file": "^6.0.1", "cordova-plugin-file-transfer": "^1.7.1", "cordova-plugin-filepath": "^1.5.1", "cordova-plugin-insomnia": "git+https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git", "cordova-plugin-ionic-keyboard": "^2.1.2", "cordova-plugin-ionic-webview": "^2.1.0", "cordova-plugin-network-information": "^2.0.1", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-whitelist": "^1.3.3", "cordova-sqlite-storage": "^3.1.0", "core-js": "^2.5.3", "graphql-tag": "^2.10.1", "ionic": "^5.2.5", "phonegap-plugin-barcodescanner": "^8.0.0", "platform": "1.3.5", "rxjs": "6.3.3", "rxjs-compat": "^6.3.3", "types": "^0.1.1", "typescript": "3.1", "zone.js": "^0.8.26" }, "devDependencies": { "@angular-devkit/architect": "~0.10.5", "@angular-devkit/build-angular": "~0.10.5", "@angular-devkit/core": "~0.7.5", "@angular-devkit/schematics": "~0.7.5", "@angular/cli": "~7.0.3", "@angular/compiler": "~7.0.3", "@angular/compiler-cli": "~7.0.3", "@angular/language-service": "~7.0.3", "@ionic/app-scripts": "^3.2.4", "@ionic/lab": "2.0.8", "@ionic/ng-toolkit": "^1.0.0", "@ionic/schematics-angular": "^1.0.0", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "^10.9.4", "codelyzer": "~4.4.2", "cordova-plugin-bluetooth-serial": "^0.4.7", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~3.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.0", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.11.0" }, "description": "SI Install App", "cordova": { "plugins": { "cordova-plugin-whitelist": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": {}, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-insomnia": {}, "cordova-plugin-network-information": {}, "cordova-sqlite-storage": {}, "cordova-plugin-file": {}, "cordova-plugin-filepath": {}, "cordova-plugin-file-transfer": {}, "cordova-plugin-camera": {}, "cordova-plugin-bluetooth-serial": {} }, "platforms": [ "browser", "android" ] } }

Can confirm this issue after deleting node_modules and running npm i with following deps:
"aws-amplify": "^1.1.38"
"aws-amplify-react": "^2.3.9"

The temporary fix worked fine for me, as I'm not compiling to an APK like @satishmolletipipra. Perhaps there's a flag you can set on the Ionic level to ignore checking modules? I'm not familiar with Ionic sorry.

Are there any plans for amplify to start using @types/zen-observable 0.8.0? Would be nice if the package was in line with app-sync so we didn't have to circumvent the type checking of declaration files using the temporary fix outlined in https://github.com/aws-amplify/amplify-js/issues/1732#issuecomment-450761829

@Ashish-Nanda We forked the https://github.com/aws-amplify/amplify-js repository and we are trying to customize the errors but am not able to build and publish the code. can you please help me on this, how can we run, build and publish the code.

Thanks everyone for the input! Based on your details, I was able to identify where the regression appeared and opened https://github.com/aws-amplify/amplify-js/pull/4494/ to resolve it.

@ericclemmons awesome - thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karlmosenbacher picture karlmosenbacher  ยท  3Comments

shinnapatthesix picture shinnapatthesix  ยท  3Comments

leantide picture leantide  ยท  3Comments

DougWoodCDS picture DougWoodCDS  ยท  3Comments

lucasmike picture lucasmike  ยท  3Comments