Amazonka: is it possible to work around deserialisation bug?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Amazonka: is it possible to work around deserialisation bug?

Magnus Therning

I just created issue #517 on Amazonka [^1] which got me thinking.

Is my only option to wait for the bug to be fixed or can I hack my
way
around it?

I looked around in the documentation for Amazonka a bit but failed
to
find some obvious way to hack together a "send this request but
give me
the response in JSON". Which is why I'm trying my luck here. I
suspect
I'm not the first Amazonka user to find myself in this situation,
so
hopefully someone's got a solution already.

/M

[^1]: https://github.com/brendanhay/amazonka/issues/517

--
Magnus Therning              OpenPGP: 0x927912051716CE39
email: [hidden email]
twitter: magthe              http://magnus.therning.org/

Computers are useless. They can only give you answers.
     — Pablo Picasso

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

signature.asc (847 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Amazonka: is it possible to work around deserialisation bug?

Utku Demir-2
Hey,

I had a similar problem before, my workaround was creating a newtype wrapper around the original request and implementing 'AWSRequest' instance by hand. That let me override the way response is parsed.


Hope it helps,
Utku

On Sat, Feb 9, 2019, at 10:11 PM, Magnus Therning wrote:

I just created issue #517 on Amazonka [^1] which got me thinking.

Is my only option to wait for the bug to be fixed or can I hack my 
way
around it?

I looked around in the documentation for Amazonka a bit but failed 
to
find some obvious way to hack together a "send this request but 
give me
the response in JSON". Which is why I'm trying my luck here. I 
suspect
I'm not the first Amazonka user to find myself in this situation, 
so
hopefully someone's got a solution already.

/M

[^1]: https://github.com/brendanhay/amazonka/issues/517

--
Magnus Therning              OpenPGP: 0x927912051716CE39
twitter: magthe              http://magnus.therning.org/

Computers are useless. They can only give you answers.
     — Pablo Picasso

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

Attachments:
  • signature.asc


_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: Amazonka: is it possible to work around deserialisation bug?

Magnus Therning

Utku Demir <[hidden email]> writes:

> Hey,
>
> I had a similar problem before, my workaround was creating a
> newtype
> wrapper around the original request and implementing
> 'AWSRequest'
> instance by hand. That let me override the way response is
> parsed.
>
> I dug up the code, the override is here:
> https://github.com/utdemir/distributed-fork/blob/edadea209e7e1fda77ca1d37011734771f6559de/serverless-execute-aws-lambda/src/Network/AWS/Lambda/Invoke/Fixed.hs
> And here is how I sent the request:
> https://github.com/utdemir/distributed-fork/blob/edadea209e7e1fda77ca1d37011734771f6559de/serverless-execute-aws-lambda/src/Network/Serverless/Execute/Lambda/Internal/Invoke.hs#L78
That's an arguably nicer way than how I solved it; I just removed
the
bits causing the error since I didn't need them anyway:

https://github.com/magthe/amazonka/commit/1543b65e3a8b692aa9038ada68aaed9967752983

Then I used `stack` to point to my modified version. I wouldn't be
surprised if people on the list already know how, but just in case
I'll
throw in a link to my description of it:
http://magnus.therning.org/posts/2019-02-10-000-using-stack-to-get-around-upstream-bugs.html

/M

--
Magnus Therning              OpenPGP: 0x927912051716CE39
email: [hidden email]
twitter: magthe              http://magnus.therning.org/

If you can tell the truth, you don't have to remember anything.
     — Mark Twain

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

signature.asc (847 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Amazonka: is it possible to work around deserialisation bug?

Haskell - Haskell-Cafe mailing list
Newtype would be my plan, too.

Also really glad to see this thread, because I’m *also* trying to migrate away from “stringing CLI calls together with bash” to a sensible programming model, and this is great to be aware of before I get too into it.

Thanks for reporting it upstream (both to the library and to Amazon)!

---
ProofTechnique

> On Feb 18, 2019, at 15:58, Magnus Therning <[hidden email]> wrote:
>
>
> Utku Demir <[hidden email]> writes:
>
>> Hey,
>>
>> I had a similar problem before, my workaround was creating a newtype
>> wrapper around the original request and implementing 'AWSRequest'
>> instance by hand. That let me override the way response is parsed.
>>
>> I dug up the code, the override is here:
>> https://github.com/utdemir/distributed-fork/blob/edadea209e7e1fda77ca1d37011734771f6559de/serverless-execute-aws-lambda/src/Network/AWS/Lambda/Invoke/Fixed.hs
>> And here is how I sent the request:
>> https://github.com/utdemir/distributed-fork/blob/edadea209e7e1fda77ca1d37011734771f6559de/serverless-execute-aws-lambda/src/Network/Serverless/Execute/Lambda/Internal/Invoke.hs#L78
>
> That's an arguably nicer way than how I solved it; I just removed the
> bits causing the error since I didn't need them anyway:
>
> https://github.com/magthe/amazonka/commit/1543b65e3a8b692aa9038ada68aaed9967752983
>
> Then I used `stack` to point to my modified version. I wouldn't be
> surprised if people on the list already know how, but just in case I'll
> throw in a link to my description of it: http://magnus.therning.org/posts/2019-02-10-000-using-stack-to-get-around-upstream-bugs.html
>
> /M
>
> --
> Magnus Therning              OpenPGP: 0x927912051716CE39
> email: [hidden email]
> twitter: magthe              http://magnus.therning.org/
>
> If you can tell the truth, you don't have to remember anything.
>    — Mark Twain
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.