alibaba / alibaba/funcraft

"fun local start" does not act like api gateway

Open
#173 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
931
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Right now testing [Using Function Compute as API Gateway's backend service](https://www.alibabacloud.com/help/doc-detail/54788.htm#Create%20and%20define%20a%20Function%20Compute%20backend%20service%20API) **locally** is very difficult.

Could it please be made similar to testing [http triggers locally](https://github.com/aliyun/fun/blob/master/lib/commands/local/http-support.js#L40).

For example:

If I have a resource like this
```yaml
apiGroup:
Type: "Aliyun::Serverless::Api"
Properties:
StageName: RELEASE
DefinitionBody:
"/gateway-example":
get:
x-aliyun-apigateway-api-name: example
x-aliyun-apigateway-fc:
arn: acs:fc:::services/${gatewayExample.Arn}/functions/${functionExample.Arn}/
timeout: 10000
```

I would like to be able to run `fun local start`
and then curl this

```shell
curl -i --get --include 'http://localhost:8000/gateway-example' -H 'Authorization:APPCODE 你自己的AppCode'
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading lib/commands/local/http-support.js, the existing local HTTP trigger support referenced in the issue. Run fun local start with the shown API resource, then use the provided curl request to compare the current behavior with the requested gateway-style route; done means the local endpoint responds through /gateway-example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.