Closed jamestharpe closed 6 years ago
Hi James!
Currently the code expects diagram data to be encoded with PlantUML's text encoding explained here: http://plantuml.com/pte
The above page links to a javascript implementation and here's a node package too: https://www.npmjs.com/package/plantuml-encoder
See the example diagram links in the readme for working examples.
The binary response setup needs to be done with API Gateway directly. After deploying with serverless, find the API Gateway instance in the AWS web console and access "Binary Support" in its menu. Add "/" as binary media type there. Sadly this still can't be done easily with serverless after almost a year.
Closing this old issue.
I recently added serverless plugins to handle the binary response setup. Also, there's now a way to deploy using AWS Serverless repository (https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:293246570391:applications~plantuml-render). There's also a UI for testing and light use.
The requirement to encode the diagrams in URL path remains.
The easiest way I've found to encode is with a node cli app (https://www.npmjs.com/package/node-plantuml):
npm install node-plantuml -g
puml encode path/to/diagramFile.plantuml
Also you can grab encoded URLs from the diagram images displayed in the UI.
Hi!
I've deployed the service, but whenever I attempt to generate a diagram I get gibberish as a response. For example:
https://XXX.execute-api.us-east-1.amazonaws.com/dev/txt/%40startuml%0ABob%20-%3E%20Alice%20%3A%20hello%0A%40enduml
Returns:
eyJpc0Vycm9yIjp0cnVlLCJlcnJvcnMiOlsiQ291bGQgbm90IGRlY29kZSBVTUwgZnJvbSByZXF1ZXN0IHBhdGg6ICU0MHN0YXJ0dW1sJTBBQm9iJTIwLSUzRSUyMEFsaWNlJTIwJTNBJTIwaGVsbG8lMEElNDBlbmR1bWwiXSwiZGlhZ3JhbVR5cGUiOiJVTktOT1dOIiwiZXJyb3JMb2NhdGlvbiI6IjAiLCJzdWdnZXN0aW9ucyI6W119
Which, when decoded, reads:
{"isError":true,"errors":["Could not decode UML from request path: %40startuml%0ABob%20-%3E%20Alice%20%3A%20hello%0A%40enduml"],"diagramType":"UNKNOWN","errorLocation":"0","suggestions":[]}
I also tried a bas64 encoded string:
https://XXX.execute-api.us-east-1.amazonaws.com/dev/txt/QHN0YXJ0dW1sDQpCb2IgLT4gQWxpY2UgOiBoZWxsbw0KQGVuZHVtbA==
Which returns:
QHN0YXJ0dW1sICAgICAgICAgICAgICAgIAonIHVuYWJsZSB0byBkZWNvZGUgc3RyaW5nCl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl4KIEVtcHR5IGRlc2NyaXB0aW9uICAgICAgIAogU3ludGF4IEVycm9yPyAgICAgICAgICAgCg==
Which decodes to:
So I'm not sure how to call the service via a URL.
If I try to run the service from the command line, I get an error:
And again, with base64 encoded argument which gave the same error.
Finally, I noted in the README that:
However, I'm not sure what this is referring to or where to set it up.
Any help you can provide would be appreciated.
Thanks,
-James