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

Send HTTP requests from inside the workers (fetch support) #165

Closed
6 tasks done
Angelmmiguel opened this issue Jun 26, 2023 · 1 comment
Closed
6 tasks done

Send HTTP requests from inside the workers (fetch support) #165

Angelmmiguel opened this issue Jun 26, 2023 · 1 comment
Assignees
Labels
🚀 enhancement New feature or request
Milestone

Comments

@Angelmmiguel
Copy link
Contributor

Angelmmiguel commented Jun 26, 2023

Is your feature request related to a problem? Please describe.

When I write a worker, I can only rely on the data that comes from a local file (mounted folders), environments variables or hardcoded in code. This reduces the kind of projects I can develop.

Describe the solution you'd like

I would like to call an external HTTP API from inside a worker. Every language has its own way to do it, so I want to use those common patterns. For example, the fetch method is the most common API for calling an HTTP endpoint in JavaScript.

To follow the capability-based approach, I want to configure the HTTP endpoints a worker can call. I want to avoid a worker calling random HTTP endpoints. For this, I would add a new section in the TOML file called "features". This object includes one configuration per feature like:

[features]
[features.fetch]
allowed_domains = ["https://example.com"]
force_ssl = true

Host implementation

Language implementation

I will start with JavaScript, but I will extend the support to other languages soon:

Future implementations

@Angelmmiguel
Copy link
Contributor Author

Now that we have support for Go, Rust and JavaScript, I plan to split the remaining languages (Python and Ruby) into separate tasks. Note that languages that requires an external runtime follows a different lifecycle and we can publish them afterwards.

With the new versions, Python and Ruby workers will continue working but they won't be able to make HTTP requests yet. We will work on adding support to those soon 😄

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

No branches or pull requests

1 participant