Skip to content

jwk.ex: Reading from pem file fails with FunctionClauseError #138

@ironaimer

Description

@ironaimer

Hi @potatosalad !
Hopefully you are doing well :)

I've got FunctionClauseError while sequentially calls of JOSE.JWK.from_pem_file("path_to_file/file.crt.pem") from our Elixir module.
The processing logic is invoked in parallel via bash script. But I assume jwk.ex calls is executed one-by-one.
The pem file definitely exists on the filesystem - 9 of 10 calls are executed successfully.
The problem is sometime jose_jwk:from_pem_file returns false {error, enoent} for existing file. The reason of this ReadError is not fully clear for me, maybe due to slow file:read_file return in sequence calls or other OTP issue.

Anyway it end up the entire pipe
def from_pem_file(file), do: :jose_jwk.from_pem_file(file) |> from_record()
gets broken.

(FunctionClauseError) no function clause matching in JOSE.JWK.from_record/1\n (jose 1.11.1) lib/jose/jwk.ex:30: JOSE.JWK.from_record({:error, :enoent})

jose version is 1.11.1.

I'm not sure about potential solution here. Maybe just modifying the pipe to avoid FunctionClauseError crash ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions