Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https.request for cloudflare #323

Open
1 task done
fl0wo opened this issue Oct 10, 2024 · 9 comments
Open
1 task done

https.request for cloudflare #323

fl0wo opened this issue Oct 10, 2024 · 9 comments
Labels
cloudflare enhancement New feature or request

Comments

@fl0wo
Copy link

fl0wo commented Oct 10, 2024

Describe the feature

Hi, just to make sure, is https.request implemented for cloudflare?

If not, do you think there an ETA for it? I'd love to help if possible.

Additional information

  • Would you be willing to help implement this feature?

Tasks

No tasks being tracked yet.
@fl0wo fl0wo added the enhancement New feature or request label Oct 10, 2024
@fl0wo
Copy link
Author

fl0wo commented Oct 16, 2024

Any update on this?

@keiwanmosaddegh
Copy link

I'm also interested in this.
@fl0wo have you found any workaround in the meantime?

@vicb
Copy link
Contributor

vicb commented Nov 1, 2024

Hi, just to make sure, is https.request implemented for cloudflare?

confirmed that it is not.

Could you please expand on the use case?

@keiwanmosaddegh
Copy link

Hi, just to make sure, is https.request implemented for cloudflare?

confirmed that it is not.

Could you please expand on the use case?

I'm quite new to Cloudflare workers and all so there might be a clear solution for my issue, however I haven't been able to troubleshoot myself to something.

I'm building a Worker API that uses Firebase App Check for Auth. I'm getting the uenv not implemented error when using the App Check library. That's why I'm in need of it. Let me know if I can help by elaborating further. @vicb

@vicb
Copy link
Contributor

vicb commented Nov 2, 2024

As you probably already knows Workers use the workerd Runtime that does not implement all of the Node.js APIs.

However we are looking at supporting more and more of the Node libs.

There are a few things that can help here:

  • cloudflare implementing the missing APIs
  • unenv polyfilling the missing APIs
  • libraries being updated to run on the edge by using Web APIs instead of the Node APIs

So what you can do here to help is:

  • Create an issue on the firebase repo explaining that you want to run the code at the edge and asking for Web APIs support (i.e. fetch)
  • Create a discussion on the workerd repo explaining what repo/version/API you would like to see supported - please link to this issue, the issue on the firebase repo and mention me there

And we'll get that working.

Thanks!

@pi0
Copy link
Member

pi0 commented Nov 2, 2024

Ideally, i would love to have a polyfill based on wintercg web sockets proposal which workerd currently support (startTLS) — and it should enable a universal / spec compatible solution in the future.

Native workerd support would be cool but i think it is still viable to be discussed for unenv support :)

—-

I think we should also investigate firebase SDK issue separately, i guess it can be solved by making sure it leverages fetch for http calls (unless they really need TCP connect)

@fl0wo
Copy link
Author

fl0wo commented Nov 7, 2024

I'm also interested in this. @fl0wo have you found any workaround in the meantime?

I'm partially migrating from AWS to CF, at least for the resources it make sense to migrate from.

And in doing this hybrid architecture, I'm trying to pushing some messages from CF Worker, to SQS (directly invoking the AWS API) (using the aws-lite library https://aws-lite.org/services/sqs)

In doing so, I get the https.request not implemented error.

Workaround 1:
Ask aws-lite to allow me to implement a custom fetch (one that is compatible on CF env)
Denied: aws-lite/aws-lite#171

Workaround 2:
Implement an ApiGtw on AWS, that wraps SQS, and simply pushes messages to SQS with a basic API-Key authentication.
And I'll invoke that api endpoint from Cloudflare...

@pi0
Copy link
Member

pi0 commented Nov 7, 2024

(offtopic) @fl0wo have you tried aws4fetch as an alternative?

@vicb
Copy link
Contributor

vicb commented Nov 7, 2024

I can definitely recommend aws4fetch here:

  • It was created by Michael Hart who works at cf
  • It is used in @opennextjs/aws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cloudflare enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants