opsgenie / opsgenie-lamp

OpsGenie Lamp with Go SDK
Apache License 2.0
34 stars 18 forks source link

Can't attach files to alerts (413 - not a multipart request) #40

Closed eherot closed 3 years ago

eherot commented 3 years ago

Not sure if I am structuring this attachment correctly, the documentation is a little unclear here. This is what happens:

$ lamp attachFile --config /usr/local/etc/lamp.conf --alertId $alert_id --filePath ./test2 --fileName test
2021/03/12 22:36:32 INFO: Logging to file is disabled, To enable Logging to file Please specify logPath in configuration
INFO[2021-03-12T22:36:32.64567004Z] Client is configured with ApiUrl: api.opsgenie.com, LogLevel: trace, RetryMaxCount: 4
DEBU[2021-03-12T22:36:32.645771754Z] Starting to process Request &{BaseRequest:{} IdentifierType:0 IdentifierValue:8e77890b-cdcd-4163-afc8-03ee3b39d6e0 FileName:test FilePath:./test2 User: IndexFile:}: to send: /v2/alerts/8e77890b-cdcd-4163-afc8-03ee3b39d6e0/attachments
ERRO[2021-03-12T22:36:32.799184329Z] Error occurred with Status code: 413, Message: Current request is not a multipart request, Took: 0.000000, RequestId: e966bd4e-864f-45fc-824e-b22cf17d2c78
2021/03/12 22:36:32 ERROR : Error occurred with Status code: 413, Message: Current request is not a multipart request, Took: 0.000000, RequestId: e966bd4e-864f-45fc-824e-b22cf17d2c78

The contents of test2 above:

$ cat test2
one
two
three

Someone else reported a similar issue in #20 but it was closed without being addressed.

eherot commented 3 years ago

Nevermind. It turns out that I misunderstood the docs. I did not realize that --filePath and --fileName were just being concatenated together to form a full path. Reading the source answered my question.