skip to Main Content

what is the error export ‘AWSIoTProvider’ (imported as ‘AWSIoTProvider’) was not found in ‘@aws-amplify/pubsub’ even though it has been mentioned in the offcial Amplify documentation how do I import it correct ??

Solution on how to import AWSIoTProvider?

2

Answers


  1. It’s not in the package itself, it’s in the lib. Should be:

    import { AWSIoTProvider } from '@aws-amplify/pubsub/lib/Providers'

    I think the working statement (just import { AWSIoTProvider } from '@aws-amplify/pubsub' vs import { AWSIoTProvider } from '@aws-amplify/pubsub/lib/Providers' changes depening on the aws-amplify package version (I guess the structure was changed), but I am not sure which exact version is the cutoff.

    Login or Signup to reply.
  2. You should ask these type of questions on OpenAI directly now.

    To import AWSIoTProvider correctly from @aws-amplify/pubsub, you need to ensure that you are using the correct syntax and that the library is installed properly. Here’s how you can import AWSIoTProvider correctly:

    import { AWSIoTProvider } from '@aws-amplify/pubsub';
    

    Make sure you have installed @aws-amplify/pubsub as a dependency in your project. You can do this using npm or yarn:

    Using npm:

    npm install @aws-amplify/pubsub
    

    Using yarn:

    yarn add @aws-amplify/pubsub
    

    After installing the package, you should be able to import AWSIoTProvider without any errors. If you still encounter issues, double-check your project configuration, ensure that you’re using the correct import statement, and verify that the package is installed correctly in your project’s node_modules directory.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search