Closed refacktor closed 1 year ago
The first thing I'd check is whether or not a proper Content-Type header is required so that the express-pouchdb component knows the body is JSON, otherwise it's just getting the actual string {"hello":...
You could of course force it to assume the request is always json by using a request transformation assuming that is the issue!
@dougmoscrop yes indeed, adding a -H "Content-Type: application/json"
solves the problem! Although I don't fully understand why... we can close this issue. When using the component through normal http, the header is not required.
I'm trying to use
serverless-http
to create a serverless deployment ofpouchdb-server
on top of AWS Lambda with Elastic Filesystem.My solution is here: https://github.com/refacktor/pouchdb-aws-serverless
I'm currently able to get the standard PouchDB response with a
curl -X GET ...
and was able to create a database by usingcurl -X PUT https://.../db1
.But when I try to PUT a document with:
curl -X PUT https://XXXXXXXXX.execute-api.us-west-2.amazonaws.com/prod/db1/doc1 -d '{"hello":"world", "_id":"doc1"}'
I get:{"error":"missing_id","reason":"_id is required for puts"}
My best guess here is that the PUT body is not getting forwarded by
serverless-http
, but I'm unsure how to troubleshoot further.