bnb-chain / greenfield-js-sdk

JS SDK for Greenfield
https://docs.bnbchain.org/greenfield-js-sdk/
GNU General Public License v3.0
27 stars 16 forks source link

Compatible with cloudflare worker #562

Open HelloRickey opened 1 month ago

HelloRickey commented 1 month ago

Summary

cloudflare worker is a popular serverless service. I am trying to integrate it with greenfield, but when I call delegateUploadObject to upload a file, it prompts

{
code: -1,
message: 'Browser-only version of superagent could not find XHR',
statusCode: 404
}

You can reproduce the problem by running this repository https://github.com/HelloRickey/greenfield-cloudflare-worker-test

I sincerely recommend that Greenfield be adapted to cloudflare worker. Developers can quickly build Greenfield services without having to maintain servers, which will increase the usage of greenfield. If you can solve the problems I mentioned above, I am willing to continue to maintain greenfield-cloudflare-worker, thx.

rrr523 commented 3 weeks ago

What's your Nodejs version?

The delegrateUpload's test case is worked.

HelloRickey commented 3 weeks ago

What's your Nodejs version?

The delegrateUpload's test case is worked.

My Nodejs version is v18.0.0

It runs fine in a normal nodejs service, but an error occurs in a cloudflare worker. And can I send a post request directly to the greenfield node to upload resources without using the sdk?