Skip to content

Conversation

ohaibbq
Copy link
Contributor

@ohaibbq ohaibbq commented Jul 9, 2024

Closes #286
Closes #334
Closes #144
Closes #389

@renevall
Copy link

renevall commented Nov 6, 2024

I have the same issue.

Workaround meanwhile we do

func decodePayload(payload string, v any) error {
	err := decodePayloadBigquery(payload, v)
	if err != nil {
		return decodePayloadFromEmulator(payload, &v)
	}

	return nil
}

func decodePayloadBigquery(payload string, v any) error {
	err := json.Unmarshal([]byte(payload), &v)
	if err != nil {
		return fmt.Errorf("failed to unmarshal payload from bigquery: %w", err)
	}

	return nil
}

func decodePayloadFromEmulator(payload string, v any) error {
	payload, err := strconv.Unquote(payload)
	if err != nil {
		return fmt.Errorf("failed to unquote payload: %w", err)
	}

	err = json.Unmarshal([]byte(payload), v)
	if err != nil {
		return fmt.Errorf("failed to unmarshal payload from emulator: %w", err)
	}

	return nil
}

@ohaibbq
Copy link
Contributor Author

ohaibbq commented Nov 6, 2024

@goccy mind reviewing this one for @renevall? Hope you're well!

@eduhenke
Copy link

If anyone's interested in a plug-in solution, I've used this fix and rebased it with the current repo and packaged it into a docker image: https://github.com/eduhenke/bigquery-emulator/pkgs/container/bigquery-emulator. Just use ghcr.io/eduhenke/bigquery-emulator:0.6.7

@themanifold
Copy link

Guess we're still waiting on the status of this, any updates? @goccy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants