dapr / dapr/php-sdk

PHP 8.1 - Uncaught TypeError: Dapr\Client\DaprHttpClient::tryDeleteStateAsync()

Open
#131 0 comments 1 reaction 1 assignee Claimed by @withinboredom View on GitHub
bug
Dominant language
PHP
Stars
74
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Getting the above type error when invoking `DaprClient->deleteState()`.

The implementation for this in `Dapr\Client\HttpStateTrait` calls `deleteStateAsync` which in turn calls `tryDeleteStateAsync` - triggering the error. This is caused by `tryDeleteStateAsync` requiring an `eTag`, which is defined as a `string` and isn't nullable - yet null is passed in this instance.

![image](https://user-images.githubusercontent.com/61878588/187089313-09b5fcd5-ae33-444c-b19c-114e42a15e82.png)

There are some other type errors in that file too but in my scenario I've only run into the issue with `deleteState`. The workaround seems to be to used only the `tryDeleteState` functions, and provide an `eTag`.

Updating the definition of `tryDeleteStateAsync` to have `string $etag = null,` solves the problem and appears to be the intended definition.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.