Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Analytics Plugin not working (or available?) in v6.0.8 of aws-amplify #12725

Closed
3 tasks done
Alk3m1st opened this issue Dec 19, 2023 · 5 comments
Closed
3 tasks done
Assignees
Labels
Analytics Related to analytics question General question

Comments

@Alk3m1st
Copy link

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Analytics

Amplify Categories

Not applicable

Environment information

# Put output below this line

  System:
    OS: Linux 5.10 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (2) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 614.65 MB / 5.80 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
  npmGlobalPackages:
    aws-cdk: 2.100.0
    awsp: 0.2.0
    corepack: 0.15.3
    npm: 9.5.0
    typescript: 5.1.6

Describe the bug

We have been using a Custom Analytics plugin to send events to API Gateway and then Kinesis as a journey analytics solution following guidance in the v5 documentation - https://docs.amplify.aws/javascript/prev/build-a-backend/more-features/analytics/create-custom-plugin/

This has been working well for us however when I went to upgrade to the newer v6 aws-amplify JS library so that we can benefit from the recent file size and tree shaking improvements, I've found there's no obvious equivalent or documentation around how to migrate a Custom Analytics plugin to the new version.

Expected behavior

Detailed documentation on how to migrate to the new version and where the various imports have been migrated to.

Reproduction steps

npm i aws-amplify
verify that v6 has been installed
notice that the Analytics class is not exposed and thus access to the addPluggable method
no obvious way to configure an existing Custom Analytics Plugin

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

@Alk3m1st Alk3m1st added the pending-triage Issue is pending triage label Dec 19, 2023
@pascalito007
Copy link

The are lot of issues that are no more working when migrating from v5 wich I find very frustrating.

@nadetastic nadetastic added the Analytics Related to analytics label Dec 19, 2023
@cwomack cwomack self-assigned this Dec 19, 2023
@cwomack cwomack added investigating This issue is being investigated and removed pending-triage Issue is pending triage labels Dec 19, 2023
@cwomack
Copy link
Contributor

cwomack commented Dec 19, 2023

Hello, @Alk3m1st 👋. We appreciate you opening this issue, as more people will likely run into this when upgrading to v6. Custom plugins for Analytics are not currently supported in v6. Can you provide more details as to what your custom plugin was doing to send events to API Gateway/Kinesis as a journey analytics solution to see if there's a workaround or alternative that can be implemented?

@cwomack cwomack added question General question pending-response Issue is pending response from the issue requestor and removed investigating This issue is being investigated labels Dec 19, 2023
@Alk3m1st
Copy link
Author

Hello, @Alk3m1st 👋. We appreciate you opening this issue, as more people will likely run into this when upgrading to v6. Custom plugins for Analytics are not currently supported in v6. Can you provide more details as to what your custom plugin was doing to send events to API Gateway/Kinesis as a journey analytics solution to see if there's a workaround or alternative that can be implemented?

Hi @cwomack.

Happy to provide more details if you can recommend an alternative or workaround.

We have a Custom Plugin that implements the AnalyticsProvider interface from @aws-amplify/analytics to enable us to send custom events that can contain additional context fields, can be enriched with additional data (such as who was the producer) and also additional meta data (we borrowed some of this from how CloudWatch RUM works). We have a custom event buffer and event dispatcher for batching the events through to our API gateway endpoint.

We use Amplify from @aws-amplify/core to configure our endpoint, API key, etc. We also use Credentials, Signer and StorageHelper from @aws-amplify/core as we're not using the Auth module and need to manually configure the Credentials service. This works similar to RUM with our Identity Pool and STS allowing us to assume an unauth role. These seem to be internal in v6 and not exposed anymore? The StorageHelper allows us to create and save a short-lived sessionId in local storage to help consolidate events to a user/device.

On the API Gateway side we perform some lightweight validation before going into a Kinesis Stream and writing to an S3 bucket via Firehose. Ultimately we ingest these events into our Data Lake. We are only using the Amplify JS library, not the platform, we use CDK for our infrastructure.

Hopefully there's a migration strategy we could use to get onto v6 or a straightforward alternative that allows us to keep sending the same events through to our Data Lake.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue requestor label Dec 20, 2023
@Alk3m1st
Copy link
Author

Just checking in to see if there's been any movement or updates since I raised this issue?

@cwomack
Copy link
Contributor

cwomack commented May 9, 2024

@Alk3m1st, wanted to follow up on this issue after reviewing it further with our team. With v6 functional approach, you shouldn't need to implement your own solution as an Amplify plugin and can use the fetchAuthSession API in Auth to obtain credentials for the user along with the @smithy/signature-v4 package package for Signer. For the Signer aspect of this issue in particular, we have #13340 as a feature request already if you'd like to add a comment/update on it.

With the above said, I'll close this issue out for now... but we can reopen if we revisit our support Custom Analytics Plugins again.

@cwomack cwomack closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Analytics Related to analytics question General question
Projects
None yet
Development

No branches or pull requests

4 participants