amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Getting Error in ADD Amplify Pluggable

Open saharJ95 opened this issue 3 years ago • 3 comments

Before opening, please confirm:

JavaScript Framework

Not applicable

Amplify APIs

REST API

Amplify Categories

No response

Environment information

Node Version: v16.13.1
"aws-amplify": "^4.3.35",
"@aws-amplify/pubsub": "^4.5.3"



Describe the bug

Hi There, Issue : amplify.addPluggable throws error when deploy on Aws Amplify Project but works fine on Localhost

Node Version: v16.13.1 "aws-amplify": "^4.3.35", "@aws-amplify/pubsub": "^4.5.3"

Locally everything is fine either its adding provider or creating mqtt connection but after deployment on amplify it throws above errorGetting Error in ADD Amplify Pluggable

image

Expected behavior

To be work fine.

Reproduction steps

image image

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

saharJ95 avatar Sep 16 '22 10:09 saharJ95

A quick attempt to reproduce didn't work. I have a guess, but would need to see more of your project to validate.

The function getCategoryName is only part of the ConsoleLogger class, which is built similar to an Amplify Provider, but had a different interface. If I used the ConsoleLogger and called Amplify.register passing in my ConsoleLogger then when I call addPluggable it would test to see if the pluggable fit in the ConsoleLogger structure, which would exit with this error.

I don't see any other way that I might come to this error. What does the contents of src/utility/Logger look like? If you leave that dependency and log setup out, does the problem still happen?

stocaaro avatar Sep 19 '22 20:09 stocaaro

tempsnip This is my logger.js file

saharJ95 avatar Sep 20 '22 03:09 saharJ95

It works fine if I removed the code of line:15 and line:17 ..but can you please help me with using both CloudWatchProvider and AWSIoTProvider ?

saharJ95 avatar Sep 20 '22 03:09 saharJ95

Interesting. You've confirmed that PubSub/AWSIoTProvider is working as expected when not using AWSCloudWatchProvider, are you sure that AWSCloudWatchProvider is working when not using PubSub/AWSIoTProvider?

From what you've said, I would guess that there is a problem in how AWSCloudWatchProvider is configured. Are you following a specific guide to setup/configure AWSCloudWatchProvider?

stocaaro avatar Nov 14 '22 20:11 stocaaro