'Dapr component is not able to find local secret file

My newly created Dapr component is not able to find the local secret file.

I am getting following error:

FATA[0005] process component my-secret-store error: missing local secrets file in metadata  app_id=myapp instance=Prithvipals-MacBook-Pro.local scope=dapr.runtime type=log ver=1.5.1

I have created component file and secret file following tree structure:

.
├── my-components
│   └── localSecretStore.yaml
└── mysecrets.json

1 directory, 2 files

Below is the content of localSecretStore.yaml file:

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: my-secret-store
  namespace: default
spec:
  type: secretstores.local.file
  version: v1
  metadata:
  - name: secretFile
    value: mysecrets.json
  - name: nestedSeparator
    value: ":"

below is the content of mysecrets.json file:

{
   "my-secret" : "I'm Batman"
}

I am following this doc. As mentioned in this doc the secret file path should be a relative path from where I am running dapr component. I am running dapr command from the parent folder of my-component so I kept file name as relative path.

I am running following command:

dapr run --app-id myapp --dapr-http-port 3500 --components-path ./my-components


Solution 1:[1]

The value of "secretFile" key should contain the absolute path of the mysecrets.json file, or it can be the path relative to the folder from where you are running the dapr run command.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aliasgar110