question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Analytics.record` will send request to localhost

See original GitHub issue

Describe the bug Analytics.record(“xxx”) will send request to localhost, instead of the AWS endpoint

To Reproduce I followed the Web app analytics guide in Pinpoint -> All projects -> My App -> Settings -> Web app analytics.

Using following code:

import Analytics from '@aws-amplify/analytics';
import Auth from '@aws-amplify/auth';

const amplifyConfig = {
  Auth: {
    identityPoolId: 'dummy',
    region: 'us-west-2'
  }
}
//Initialize Amplify
Auth.configure(amplifyConfig);

const analyticsConfig = {
  AWSPinpoint: {
        // Amazon Pinpoint App Client ID
        appId: 'dummy',
        // Amazon service region
        region: 'us-west-2',
        mandatorySignIn: false,
  }
}

Analytics.configure(analyticsConfig)

//Record an event
Analytics.record('some-event-name');

And Analytics.record will send a fetch request to https://localhost/ with request payload {IdentityPoolId: "us-west-2:XXXXXXXXX"}

Expected behavior Record should be send to aws pinpoint server, not localhost

What is Configured? All configs are in the code snap

Additional context

Logs

[DEBUG] 43:34.873 AWSPinpointProvider - _public record {event: {…}, provider: "AWSPinpoint"}
VM4289:9431 [DEBUG] 43:34.874 Credentials - getting credentials
VM4289:9431 [DEBUG] 43:34.874 Credentials - picking up credentials
VM4289:9431 [DEBUG] 43:34.875 Credentials - getting new cred promise
VM4289:9431 [DEBUG] 43:34.875 Credentials - checking if credentials exists and not expired
VM4289:9431 [DEBUG] 43:34.875 Credentials - need to get a new credential or refresh the existing one
VM4289:9431 [DEBUG] 43:34.876 AuthClass - Getting current user credentials
VM4289:9431 [DEBUG] 43:34.877 AuthClass - Getting current session
VM4289:9441 [DEBUG] 43:34.877 AuthClass - getting session failed undefined
VM4289:9431 [DEBUG] 43:34.878 Credentials - setting credentials for guest
Promise {<pending>}__proto__: Promise[[PromiseStatus]]: "pending"[[PromiseValue]]: undefined
VM4289:9441 [DEBUG] 44:37.982 Credentials - Failed to load credentials Promise {<rejected>: TypeError: Failed to fetch}
VM4289:9441 [DEBUG] 44:37.983 AWSPinpointProvider - set credentials for analytics TypeError: Failed to fetch
VM4289:9431 [DEBUG] 44:37.985 AWSPinpointProvider - init clients
VM4289:9441 [DEBUG] 44:37.985 AWSPinpointProvider - init clients with credentials {accessKeyId: undefined, sessionToken: undefined, secretAccessKey: undefined, identityId: undefined, authenticated: undefined}
VM4289:9441 [DEBUG] 44:37.995 EventsBuffer - Instantiating buffer with config: {bufferSize: 1000, flushSize: 100, flushInterval: 5000, resendLimit: 5, disabled: undefined, …}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Amplifiyercommented, Apr 26, 2020

We have figured out the root cause, aws_sdk version got upgraded on friday and the client versions that amplify-js are using is incompatible with the upgraded dependencies.

We are working with aws-sdk team to fix this as soon as possible

1reaction
taylornewtoncommented, Apr 27, 2020

The rollback is working for me. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can you test google analytics on a localhost address?
Yes, you do, but not for them to access you, you need it just to have Host attribute in HTTP request. I think...
Read more >
Localhost:4444 Showing Up in Google Analytics | SEO Forum
Hello All,. Lately in my Google Analytics account I have noticed a referral source labelled: localhost:4444. The number of visits is really ...
Read more >
Can I use Google Analytics on localhost? - Quora
I think in your case, you are asking whether we can use Google Analytics to track down website which are not “ours” ,...
Read more >
Google Analytics source - Webmasters Stack Exchange
Is it that someone trying on their system locally and clicking from that page to redirect to my site or what? also Bounce...
Read more >
Does Google Analytics Track Localhost Activity? - Medium
How can I stop GA from running on localhost? ... Wrap your Google Analytics code inside this code block. ... What does that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found