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.

Timestamp Microservice fails working projects if the user's clock is set wrong

See original GitHub issue

The empty date tests (the last two tests) never succeed, even if meeting the tests demands. I’ve checked this manually using the browser with my Glitch project URL https://lean-shroud.glitch.me/api/timestamp/ which is to query the API with an empty date and it correctly returns the current datetime in Unix and UTC format.

I’ve checked the tests source: getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp'').then(data => { var now = Date.now(); assert.approximately(data.unix, now, 20000) ;}, xhr => { throw new Error(xhr.responseText); }) getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp'').then(data => { var now = Date.now(); var serverTime = (new Date(data.utc)).getTime(); assert.approximately(serverTime, now, 20000) ;}, xhr => { throw new Error(xhr.responseText); }) to make sure I’m returning the expected object with the “unix” and “utc” props and that they also contain the correct value, and they do, however, this line seems to fail assert.approximately....

  • Browser Name: Google Chrome
  • Browser Version: 72.0.3626.81 (Official build) (64 bits)
  • Operating System: Windows 10 Pro

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
ojeytonwilliamscommented, Nov 21, 2019

Okay, I think your original idea

this line seems to fail assert.approximately....

is mostly likely correct, since that would result in the tests failing without any logs. AssertionErrors are not reported to the console, since the site already tells you if a test is failing.

I’m not sure why this would be the case, but potentially your system clock is out of sync with Glitch, so is reporting a UTC that’s more than 20s away from the server time. So, first thing I would suggest is to synchronize your clock. If that doesn’t help, we can explore other options.

1reaction
jsilvaocommented, Nov 19, 2019

Sorry for the delay, yes, I will record a video as you asked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timestamp Microservice - freeCodeCamp APIs and ... - YouTube
This is a full walkthrough for the Timestamp Microservice project on freeCodeCamp. We create an express app and set up a route for...
Read more >
How to Handle Timezones and Synchronize Your Software ...
I first choose a random timestamp which isn't at midnight. Then compare the result with the timestamp for the same day at midnight....
Read more >
Event-based Microservices: Error Handling - Medium
We have a flow of data and when an event errors, we again mark it as processed and bump it to the side,...
Read more >
5 patterns to make your microservice fault-tolerant - ITNEXT
Timestamp : pass point of time at which your service will stop waiting for response. First, gateway/frontend service sets deadline to 'current ...
Read more >
JHipster 7.1.0: Failed to use jdl-import, throws Error looking for ...
The error occurs because you're using JWT authentication type and not OAuth2. For OAuth2, there is a mechanism in the microservice to ...
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