amplify-js: PubSub throws error suggesting identityPoolId is not set, when in fact it is.

Auth.currentCredentials() shows correct identityPoolId but when I try to publish or subscribe it throws the error

[Unhandled promise rejection: TypeError: Cannot read property 'identityPoolId' of undefined]
- node_modules/@aws-amplify/pubsub/node_modules/@aws-amplify/core/lib/Credentials.js:198:37 in __generator$argument_1
* http://192.168.1.128:19003/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:503494:21 in step
- node_modules/@aws-amplify/pubsub/node_modules/@aws-amplify/core/lib/Credentials.js:25:30 in <anonymous>
* http://192.168.1.128:19003/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:503396:69 in <unknown>
- node_modules/promise/setimmediate/core.js:45:4 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:12 in doResolve
- node_modules/promise/setimmediate/core.js:66:2 in Promise
* http://192.168.1.128:19003/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:503375:12 in __awaiter
- node_modules/@aws-amplify/pubsub/node_modules/@aws-amplify/core/lib/Credentials.js:190:4 in <anonymous>
- node_modules/@aws-amplify/pubsub/node_modules/@aws-amplify/core/lib/Credentials.js:399:17 in prototype.set

I was working on a project from scratch and had simply added default auth config with phone number as username, nothing custom. I didn’t implement the signUp confirmation yet so I manually verified the test user from AWS console.

Expected behavior SignIn works perfectly so it’s expected that pubsub would also work correctly given the right permissions are set.

Environment
System:
    OS: Linux 5.3 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: x64 AMD Ryzen 7 2700X Eight-Core Processor
    Memory: 3.79 GB / 31.33 GB
    Container: Yes
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 13.6.0 - /usr/bin/node
    Yarn: 1.21.1 - /usr/bin/yarn
    npm: 6.13.4 - /usr/bin/npm
  Browsers:
    Chrome: 79.0.3945.88
    Firefox: 72.0.1
  npmPackages:
    expo-cli: ^3.11.5 => 3.11.5 
    global: ^4.4.0 => 4.4.0 
    react-dev-tools: ^0.0.1 => 0.0.1 
    react-devtools: ^4.4.0 => 4.4.0 
  npmGlobalPackages:
    npm: 6.13.4
    serverless-appsync-plugin: 1.1.2

Smartphone (please complete the following information):

  • Device: OnePlus6T
  • OS: Android 10

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (1 by maintainers)

Most upvoted comments

This problem was finally resolved by downgrading all amplify packages to 2.1.0. Still unsure what was the peculiar case causing this problem for me.