apache / apache/pulsar

[Bug] pulsar-admin functions upload does not appear to work at all.

Open
#18,972 7 comments 0 reactions 0 assignees View on GitHub
Stale type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Version

Similar to #18966, pulsar functions cannot be updated with a file uploaded using `pulsar-admin functions upload`. In fact, `pulsar-admin functions upload` does not seem to do anything at all.

```
$ pulsar-admin functions upload --path myfuncs/testfunc --source-file `pwd`/funcbin
Uploaded successfully
$ pulsar-admin functions create --go 'file:myfuncs/testfunc' --name test --inputs persistent://public/default/test
2022-12-17T13:58:38,153-0500 [AsyncHttpClient-7-1] WARN org.apache.pulsar.client.admin.internal.BaseResource - [http://localhost:8080/admin/v3/functions/public/default/test] Failed to perform http post request: javax.ws.rs.BadRequestException: HTTP 400 Bad Request
Encountered error "URI is not hierarchical" when getting Function package from file:myfuncs/testfunc

Reason: Encountered error "URI is not hierarchical" when getting Function package from file:myfuncs/testfunc

$ pulsar-admin functions create --go 'file:/myfuncs/testfunc' --name test --inputs persistent://public/default/test
2022-12-17T14:03:48,028-0500 [AsyncHttpClient-7-1] WARN org.apache.pulsar.client.admin.internal.BaseResource - [http://localhost:8080/admin/v3/functions/public/default/test] Failed to perform http post request: javax.ws.rs.BadRequestException: HTTP 400 Bad Request
Encountered error "file:/myfuncs/testfunc does not exists locally" when getting Function package from file:/myfuncs/testfunc

Reason: Encountered error "file:/myfuncs/testfunc does not exists locally" when getting Function package from file:/myfuncs/testfunc
$ pulsar-admin functions create --go 'file://myfuncs/testfunc' --name test --inputs persistent://public/default/test
2022-12-17T13:58:55,985-0500 [AsyncHttpClient-7-1] WARN org.apache.pulsar.client.admin.internal.BaseResource - [http://localhost:8080/admin/v3/functions/public/default/test] Failed to perform http post request: javax.ws.rs.BadRequestException: HTTP 400 Bad Request
Encountered error "URI has an authority component" when getting Function package from file://myfuncs/testfunc

Reason: Encountered error "URI has an authority component" when getting Function package from file://myfuncs/testfunc

$ docker exec -it my_pulsar_standalone /bin/bash
I have no name!@79b75f3b4299:/$ cd /
I have no name!@79b75f3b4299:/$ find . -name *testfunc* 2>&1|grep -v "Permission denied"
I have no name!@79b75f3b4299:/$ #nothing found
```

### Minimal reproduce step

- build go function (perhaps python and java too, can't test)
- `pulsar-admin functions upload --path myfuncs/testfunc --source-file `
- `pulsar-admin functions create --go 'file:myfuncs/testfunc' --name test --inputs persistent://public/default/test`
- OR: `pulsar-admin functions create --go 'file:/myfuncs/testfunc' --name test --inputs persistent://public/default/test`
- OR: `pulsar-admin functions create --go 'file://myfuncs/testfunc' --name test --inputs persistent://public/default/test`

### What did you expect to see?

Created successfully

### What did you see instead?

- `functions create --go 'file:myfuncs/testfunc`
- `"URI is not hierarchical"`
- `functions create --go 'file:/myfuncs/testfunc`
- `"file:/myfuncs/testfunc does not exists locally"`
- `functions create --go 'file://myfuncs/testfunc`
- `"URI has an authority component"`

### Anything else?

_No response_

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the documented `pulsar-admin functions upload` and `functions create --go` commands, using each file URI form shown in the report. Trace the upload result and the subsequent local file lookup, including the standalone Docker container check. Done means the uploaded function can be created successfully from the expected reference and the reported URI errors no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.