Comments (3)
@florian-milky the skipped response should only be returned from flush
when either there are no events remaining in the buffer, or the events are incorrectly formatted. Where is it that you notice events are missing? Are they not appearing on the amplitude website?
from amplitude-node.
@ajhorst I log something when the promise is resolved. So I got like 13 logs right before logEvents, and then I got like 10 logs that the promise resolved. Then the flush resolves. On amplitude website I don't see events that didn't resolve.
Now I double checked my code and I realise I expected the promise to throw because I was using async/await, but when I stopped awaiting the logEvent, I removed the async/await which means the code is not gonna throw anymore 🤦
So I'll handle that and check why it is throwing.
Edit: ok obviously not fully awake yet. I am not catching the promise so it would fail if one of them would throw.
Some code:
export function logMetrics(metrics) {
console.log(`Logging metrics into ${process.env.ENV}`, metrics);
client
.logEvent({
event_type: 'KPI - PageSpeed audit',
user_id: 'lambda-lighthouse',
event_properties: metrics,
})
.then((r) => console.log(metrics.target, r));
}
// iterating over some stuff and calling logMetrics
console.log('Flushing metrics to amplitude');
const response = await flush();
if (response.status !== Status.Success && response.status !== Status.Skipped) {
console.log('Flushing did not work', response);
throw new Error('Could not flush amplitude events');
}
console.log('Flushed', { status: response.status });
from amplitude-node.
@florian-milky are there any console warnings in your browser window when you try this?
from amplitude-node.
Related Issues (20)
- Not compatible with Webpack 5 (Next.js 11) HOT 9
- Doesn't work with Next.js in APIs (events seem sent but aren't available on Amplitude dashboard) HOT 9
- Identify event taking too long to resolve HOT 3
- Node.js example has a bug for ES5 HOT 1
- requestTimeoutMillis breaks 1.8.0 -> 1.8.1 HOT 5
- How should I generate the device ID ? HOT 6
- User properties inheritance HOT 6
- UnhandledRejection when amplitude server is unavailable
- includeUtm HOT 1
- ChainAlert: new npm maintainer has published version 1.10.0 of package @amplitude/utils
- ChainAlert: new npm maintainer has published version 1.10.0 of package @amplitude/types
- Getting host verification error while installation npm install amplitude/node HOT 1
- Where can I see the event log in amplitude? HOT 1
- Can we send batch/bulk events at once HOT 1
- 📣 Introducing NEW Amplitude SDK for Node.js [BETA]
- Not compatible with Webpack 5 (Next.js 11) (fix)
- maj tslib to next major HOT 5
- How to track revenue? HOT 3
- insert_id parameter in amplitude android sdk
- Test Issue ticket creation in AMP
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplitude-node.