garden icon indicating copy to clipboard operation
garden copied to clipboard

0.13: [Bug]: ERR_INVALID_ARG_TYPE when garden tries to store test results when data is undefined

Open shumailxyz opened this issue 1 year ago • 0 comments

Garden Bonsai (0.13) Bug

Sometimes in running test actions, the logs show this error:

[ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined

This happens if for some reason the data is null/missing and garden tries to serialize undefined data into base64. https://github.com/garden-io/garden/blob/main/core/src/plugins/kubernetes/test-results.ts#L83

Current Behavior

It doesn't throw the error or fails because currently we catch it and log it as a warning.

Expected behavior

It shouldn't try to store undefined in configmap at all if there's no data.

Suggested solution(s)

Check why the data is undefiend in first place as the type TestResult includes timestamps of test action execution which shouldn't be null atleast.

Otherwise, also add a check in upsertConfigMap function where it serializes the data into base64. https://github.com/garden-io/garden/blob/main/core/src/plugins/kubernetes/util.ts#L394

Additional context

Your environment

  • OS:
  • How I'm running Kubernetes:

garden version

shumailxyz avatar Dec 14 '23 17:12 shumailxyz