Migrate to ofetch#904
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #904 +/- ##
===========================================
+ Coverage 44.19% 72.15% +27.96%
===========================================
Files 22 22
Lines 2100 2144 +44
Branches 195 249 +54
===========================================
+ Hits 928 1547 +619
+ Misses 1162 590 -572
+ Partials 10 7 -3
☔ View full report in Codecov by Sentry. |
|
Fixed the |
| { | ||
| "name": "@snapshot-labs/snapshot.js", | ||
| "version": "0.6.2", | ||
| "version": "1.0.0-beta.0", |
There was a problem hiding this comment.
Why this change? We shouldn't go from a normal version to a beta. Also not sure we should bump to v1. I dont see any change in function or parameters
There was a problem hiding this comment.
Pretty major change in error handling from ofetch, as pointed out in yesterday call. Beta will be released and tested only interbally first, and not for public
|
@Todmy Can you test this PR, utACK is not enough |
|
@wa0x6e could you please test your tests? I run them and have some failed |
Tests are passing on my local, and on github actions 🤔 What are the errors you're seeing ? |
|
Added retry to flaky tests depending on third party services |
|
issue persists. The reason why tests fail on my local host is that I use node@18. This package is used for projects with node@18 as well. |
|
Hmmmm… have to start adding node 18 to ci |
|
Tests fixed for node 18, also confirmed to work on node 20 |
|
I believe this should not be merged on |
|
Maybe we can leave it on this branch, can i publish it to beta tag? |
I don’t think it’s possible to have 2 versions on the same branch, it’ll create a merge conflict |
|
Published this branch to https://www.npmjs.com/package/@snapshot-labs/snapshot.js/v/0.8.0-beta.0 |


🧿 Current issues / What's wrong ?
Current
fetchrequest does not support timeout, nor keep alive connections.💊 Fixes / Solution
Migrate the fetch library from
cross-fetchtoofetch.The error handling changes from
ofetchwill also introduce a change in returned response on error.Previously, error handling looks like:
With ofetch changes,
🚧 Changes
getJSONandipfsGet(see below)getScores,validateandgetVpcode=== string)code=== number)The last argument (
options) accepts atimeoutproperty.subgrapherRequestandgetSnapshotThe last argument (
options) accepts atimeoutproperty.getJSONandipfsGetFetchErrorThe last argument (
options) accepts atimeoutproperty.send(from Client)FetchErrorofetchis handling error response differently, and is rejecting a Promise on all non-200 errors.This new update will require a bump to the next major version (1.x.x).
As this new breaking change need more testing before public release, the new 1.x.x should be released as a beta, and used only by our internal services first (and keep updated with the main branch) for a few weeks.
Once everything confirmed as working as expected, then we can public release it.
🛠️ Tests
getScores,validate,getSnapshotandgetVpfunctions with valid data