export 'AWSIoTProvider' (imported as 'AWSIoTProvider') was not found in '@aws-amplify/pubsub'

24 views Asked by At

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

There are 2 answers

0
defaultUsernameN On

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.

0
Bill On

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