Skip to content

[bug]: HttpClient - make connection setup optional in project instance creation views #1772

@igorbeslic

Description

@igorbeslic

Improvement target

HttpClient and HttpClient Connection

Re-Using connection or making connection optional especially in the cases where authorization is not required and user might not need base URL..

Improvement description

HttpClient component has property uri which would be appended to the HttpClient Connection property baseUri.

I have use case where I want to introspect/test endpoints listed in CSV file. Endpoint URLs are full URLs like https://domain.com/endpoint-a. In this moment I can not create Project Instance without assigning connection to Http Client component.

I tried to workaround the problem and I created Http Client Connection without baseUri and with Authorization set to None.

If I execute project instance in Bytechef server log there is message:

2024-11-22T18:56:40.116+01:00 ERROR 27612 --- [rver-app-task-2] com.bytechef.atlas.worker.TaskWorker     : null 

java.lang.IllegalArgumentException: null
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at com.bytechef.platform.component.ComponentDefinitionRegistry.getAuthorization(ComponentDefinitionRegistry.java:165)
	at com.bytechef.platform.component.service.ConnectionDefinitionServiceImpl.getAuthorizationRefreshOn(ConnectionDefinitionServiceImpl.java:243)
	at com.bytechef.platform.component.helper.TokenRefreshHelper.executeSingleConnectionFunction(TokenRefreshHelper.java:81)
	at com.bytechef.platform.component.facade.ActionDefinitionFacadeImpl.executePerform(ActionDefinitionFacadeImpl.java:151)
	at com.bytechef.platform.component.task.handler.AbstractTaskHandler.handle(AbstractTaskHandler.java:59)
	at com.bytechef.atlas.worker.TaskWorker.doExecuteTask(TaskWorker.java:190)
	at com.bytechef.atlas.worker.TaskWorker.lambda$onTaskExecutionEvent$0(TaskWorker.java:111)
	at com.bytechef.platform.tenant.concurrent.TenantThreadPoolTaskExecutor.lambda$getTenantRunnable$0(TenantThreadPoolTaskExecutor.java:64)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

2024-11-22T18:56:40.118+01:00 ERROR 27612 --- [egateEndpoint-1] .a.c.e.l.TaskExecutionErrorEventListener : Task id=6065: message=null_stackTrace=[java.lang.IllegalArgumentException, _at java.base/java.util.Optional.orElseThrow(Optional.java:403), _at com.bytechef.platform.component.ComponentDefinitionRegistry.getAuthorization(ComponentDefinitionRegistry.java:165), _at com.bytechef.platform.component.service.ConnectionDefinitionServiceImpl.getAuthorizationRefreshOn(ConnectionDefinitionServiceImpl.java:243), _at com.bytechef.platform.component.helper.TokenRefreshHelper.executeSingleConnectionFunction(TokenRefreshHelper.java:81), _at com.bytechef.platform.component.facade.ActionDefinitionFacadeImpl.executePerform(ActionDefinitionFacadeImpl.java:151), _at com.bytechef.platform.component.task.handler.AbstractTaskHandler.handle(AbstractTaskHandler.java:59), _at com.bytechef.atlas.worker.TaskWorker.doExecuteTask(TaskWorker.java:190), _at com.bytechef.atlas.worker.TaskWorker.lambda$onTaskExecutionEvent$0(TaskWorker.java:111), _at com.bytechef.platform.tenant.concurrent.TenantThreadPoolTaskExecutor.lambda$getTenantRunnable$0(TenantThreadPoolTaskExecutor.java:64), _at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572), _at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317), _at java.base/java.util.concurrent.FutureTask.run(FutureTask.java), _at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144), _at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642), _at java.base/java.lang.Thread.run(Thread.java:1583)] 

It would be good to consider if we would like to support this kind of case (to declare Http Client Connection as Optional). If yes, than upper stack points to bug that we should fix and update documentation on HttpCLient to be more strait forward with it.

If No, than baseUri parameter should be mandatory and I hope this error stack trace would be avoided.

Observed Version

2.3.1

Metadata

Metadata

Labels

backendConcerning any and all backend issuesbugSomething isn't working

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions