Comments (5)
So what fixed the issue in my case was to escape the value with:
$util.escapeJavaScript()
eg:
"$util.escapeJavaScript($ctx.args.long_description)"
from aws-mobile-appsync-events-starter-react.
When I edit an event in DynamoDB console to have a newline in the description, it properly shows as \n in the console, but the app displays it as a space.
from aws-mobile-appsync-events-starter-react.
A simple fix would be to escape() before creating and unescape() before displaying, but the job of satisfying DynamoDB's need for valid JSON seems to belong to the GraphQL layer or the Resolver.
from aws-mobile-appsync-events-starter-react.
Ah, I see what you mean. This is a limitation of the request mapping template currently as the result of the evaluated template is expected to be a JSON object that will be used to configure the call to DynamoDB. You can currently pass mutli-line strings through to dynamodb by referencing an argument on the context.
For example if you had this:
{
"version": "2017-02-28",
"operation": "PutItem",
"key": {
"id": { "S": "5f7a4c6d-eee0-474a-b4ca-2b52e953a8bf"}
},
"attributeValues": {
"name": { "S": "one" },
"where": { "S": "two" },
"when": { "S": "2018-02-23T00:15:00Z" },
"description": { "S": "$ctx.args.description" }
}
}
You can pass a description with newlines as you might expect. I'll take a note of this and look into the possibility of escaping the evaluated template. Thanks for the feedback!
from aws-mobile-appsync-events-starter-react.
@mikeparisstuff this solution does not work for me. I'm using RDS and it only fails when the description has a new line
from aws-mobile-appsync-events-starter-react.
Related Issues (20)
- you did not mention the schema for your events application HOT 1
- make it run with Expo (CRNA) HOT 1
- Cannot read property 'subscription' of undefined HOT 11
- Some Strange Behavior after initial setup HOT 15
- How to delete CommentTable items related to EventTable item
- Re-sync doubles data in the UI
- Deleted items stuck in the cache. HOT 1
- Duplicate events and comments are shown briefly after adding new items
- Where is schema file? HOT 1
- AppSync config example doesn't match TypeScript defs HOT 1
- Typo on Subscription
- Add OPENID_CONNECT support?
- Question: Query on single Comment HOT 1
- AppSync Offline Problem
- how to identify number of active subscribers by subscription in AppSync
- Attempted import error: 'compose' is not exported from 'react-apollo' HOT 1
- Congnito authentication HOT 1
- yarn warnings (+ 1 error?) HOT 1
- Double Mutation - React js example HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-mobile-appsync-events-starter-react.