Comments (36)
Pure JS implementation is ready to use https://github.com/grpc/grpc-node/releases/tag/%40grpc%2Fgrpc-js%401.0.0
from platform.
In v0.21 we migrated to the pure JS implementation of the gRPC library, so you can use this version for your test.
from platform.
Discussed in Triage - Merged and ready for retest in v21.
from platform.
Interesting. @jawid-h @dash-maverick shall we just release your branch as NPM module in dashevo organisation?
from platform.
@shumkov it is not, let's release our version maybe. I would merge latest updates from v6 of the original repo as well
from platform.
Hey. The investigation/fix is being currently in progress. You can expect some updates here quite soon.
from platform.
Hey guys. Just checked it out and what I found. :)
The reason why it is not working on RunKit is that they have 6.10 protobufjs package, but our package depedency is set to 6.10.5, but only 6.5.1 is available on the RunKit. So, we have two options: we can wait until RunKit will update their protobufjs package to corresponding version, or downgrade to a previous version which is available everywhere.
AWS Lambdas is working fine. Though I needed to bundle Dash SDK in zip first. The reason is that AWS Lambda does not have any internal package manager, so you have to prepare dependencies by yourself. I installed dash
package in the separate directory and put everything in the .zip file.
https://stackoverflow.com/questions/34437900/how-to-load-npm-modules-in-aws-lambda
After uploading it on my AWS, I have been able to retrieve most recent blockhash via this Lambda code:
const Dash = require('dash')
exports.handler = async (event) => {
const client = new Dash.Client();
const blockHash = await client.getDAPIClient().core.getBestBlockHash();
await client.disconnect()
const response = {
statusCode: 200,
body: JSON.stringify('The hash: ' + blockHash),
};
return response;
}
from platform.
@pshenmic good catch! @thephez shall we update documentation. Maybe we need something like "troubleshooting" section there?
from platform.
I retested it on codepen with this snippet:
<html>
<head>
<title>Load NPM package in browser</title>
<script
crossorigin src='https://unpkg.com/[email protected]/dist/dash.min.js'
></script>
</head>
<body>
<script>
async function main () {
console.log('main')
const client = new Dash.Client();
console.log('client')
const blockHash = await client.getDAPIClient().core.getBestBlockHash();
console.log("blockhash")
console.log(blockHash)
const response = {
statusCode: 200,
body: JSON.stringify('The hash: ' + blockHash),
};
await client.disconnect()
return response;
}
main()
</script>
</body>
</html>
and get a network error. This bug describes as expected behavior: Expected to be able to use DashJS without issue, regardless of platform.
So I like to keep this bug open until Dash can be confidently used on a variety of platforms without hiccup.
from platform.
Thank you so much !
I wonder if not committing package-lock.json be enough ?
Did you try with default script but with the lock file removed ?
Mentioning @antouhou @shumkov too, they might be interested.
from platform.
Thanks for the info. I have bumped into this when using repl.it (e.g. name script) recently, but thought it was something related to changes on their site and did not debug any further.
from platform.
@riongull Thank you very much for your report and the provided solution. It seems like we need to compile it manually for rare platforms. I think it's fair for everything.
I'm afraid, we can't add this post-install script 'coz it's too specific (not universal).
@Alex-Werner Removing package-lock.json
is not a case. We won't be able to guarantee that things are works properly with different deps.
What if we just document this solution and ask people to solve it manually?
P.S. We could use pure JS implementation when it ready https://github.com/grpc/grpc-node/tree/master/packages/grpc-js
from platform.
Happy to help, men. @shumkov, I think it would be good to look into whether the pure JS implementation will work for us. It seems to have pretty good feature parity.
from platform.
@Alex-Werner @shumkov Can we switch to this solution soon? Would be nice to get this issue closed.
from platform.
Yeah, but we need to ask @dalibran about priority.
from platform.
In terms of priority, this issue is no longer blocking me (or anyone else who reads this for the solution). Issue dashevo/js-dash-sdk#46 on the other hand is blocking anyone who wants to consume DashJS in a typescript file. Solving that first would not only unblock them, it should also provide IntelliSense to normal JS devs so that they can see documentation in their IDE, which lowers the urgency of keeping text docs up to date.
from platform.
Longshot as there's no direct error message, but might this also explain why dash can't be used in runkit, which gives the error Cannot find module 'grpc' ... in @dashevo/dapi-grpc/clients/nodejs/CorePromiseClient.js
?
( https://npm.runkit.com/dashand and run to recreate)
Pure js version might at least solve that problem too since https://npm.runkit.com/@grpc/grpc-js is a thing, whereas https://npm.runkit.com/grpc does indeed show it as missing.
from platform.
@shumkov Is it possible to clarify whether the additional considerations for migration below are likely to exist, or whether this should be 'a drop-in replacement'?
Migrating from grpc
@grpc/grpc-js is almost a drop-in replacement for grpc, but you may need to make a few code changes to use it:
If you are currently loading .proto files using grpc.load, that function is not available in this library. You should instead load your .proto files using @grpc/proto-loader and load the resulting package definition objects into @grpc/grpc-js using grpc.loadPackageDefinition.
If you are currently loading packages generated by grpc-tools, you should instead generate your files using the --generate_package_definitions option in grpc-tools, then load the object exported by the generated file into @grpc/grpc-js using grpc.loadPackageDefinition.
If you have a server and you are using Server#bind to bind ports, you will need to use Server#bindAsync instead.
from platform.
@cloudwheels yeah, we already use proto-loader, so It should be easy. Please check https://github.com/dashevo/dapi-grpc
P.S. Your PR as usual will be appreciated 😉
from platform.
@cloudwheels @riongull have you had success running the pure js implementation on aws or is there additional work required that we could bounty out to the incubator?
from platform.
Testing pure js implementation:
using sdk
on runkit: https://runkit.com/embed/4hfnp3oa7eki
throws: Error: Cannot find module 'protobufjs'
even though protobufjs is on runkit: https://npm.runkit.com/protobufjs
from platform.
Thanks @dashameter i've marked this as Failed Retest on the triage sheet.
from platform.
@dashameter It's probably related to dapi-grpc (see https://npm.runkit.com/@dashevo/dapi-grpc) which uses this: https://github.com/dashevo/dapi-grpc/blob/v0.22-dev/package-lock.json#L16. I frequently have issues due to a git+ssh
reference in package-lock.json for this specific dependency (which I've gotten around by borrowing this).
from platform.
@dashameter please verify workaround. Thanks
from platform.
@dashameter It's probably related to dapi-grpc (see https://npm.runkit.com/@dashevo/dapi-grpc) which uses this: https://github.com/dashevo/dapi-grpc/blob/v0.22-dev/package-lock.json#L16. I frequently have issues due to a
git+ssh
reference in package-lock.json for this specific dependency (which I've gotten around by borrowing this).
Thanks for the trick, how would I use git config --global url."https://github.com/".insteadOf ssh://[email protected]/
with runkit, though ? The whole issue to be resolved is being able to use the sdk with js only, e.g. runkit or aws lambda functions.
from platform.
@thephez can you refer to that please ?
from platform.
@dash-maverick I was using the library in a different way and the workaround I used isn't applicable for this case. Someone else (probably a dev) will need to look at this. It appears this is still an issue with the latest dev version (0.22-dev.7).
from platform.
@shumkov Some interesting discussion in a GH issue that appears related: npm/cli#2610 (comment). Perhaps updating this would fix it: https://github.com/dashevo/platform/blob/v0.22-dev/packages/dapi-grpc/package.json#L41? And https://github.com/dashevo/platform/blob/v0.22-dev/packages/js-grpc-common/package.json#L34 and https://github.com/dashevo/platform/blob/v0.22-dev/package.json#L68?
from platform.
@shumkov yeah, probably we should, let me check if a 7 version is released
from platform.
retest failed with sdk v3.21.8
from platform.
try it out with v22 please
from platform.
retest failed on v22.1
https://runkit.com/622b3b64e1ba8c000a6090da/62403edffa69e900094bb6ee
from platform.
As per triage, unable to reproduce, please retest.
from platform.
retest was requested in discord by @SamKirby22
with v22.7 it still fails:
from platform.
If we can downgrade so it runs on Runkit that would be a good idea.
from platform.
@riongull can you take a quick look at the fix for this and let us know if it's fixed (for your specific use case)?
from platform.
Related Issues (20)
- Rename repository to dash-drive
- Doc: How to install Dash Drive HOT 3
- bug: tenderdash abci version mismatch between tenderdash, rs-tenderdash, and rs-drive-abci (v0.24 vs v0.25) HOT 1
- `v1.0-dev` (the current working branch) fails to build from source HOT 3
- Missing updated .env.testnet
- Ports from various example ENV files and configs don't match up
- doc: example envoy config
- `dashmate setup local` fails with `Database already exists` HOT 4
- doc: which services start in which order HOT 2
- `envoy` fails to load as system daemon trying to access `/dev/stdout` HOT 1
- Error during contract deployment HOT 4
- Dashmate platform Block Height 0 HOT 1
- bug(dashmate): dashmate helper crashes on enourmously high linux uid
- SDK no longer works with DPNS-related methods HOT 2
- DAPIClientError: There is no connection config for network 'mainnet'
- bug(dashmate) : Platform Status error with dashmate status command, maybe related to previous SSL cert setup HOT 3
- Storing ssl certificates in a configuration file config.json HOT 5
- bug(dashmate) : DAPI API service constantly restarting, Wasm SIMD unsupported HOT 1
- Support query for masternode via (D)API HOT 3
- Can't use `new IdentityPublicKey(1)` from `@dashevo/wasm-dpp` HOT 1
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 platform.