Im trying to get AWS AppSync to work in a reason-react project. Im getting a syntax error that I have no idea what it mean. Any ideas?
This is the file:
// AppSyncConfig.re
module AppSyncConfig = {
type t = {
graphqlEndpoint: string,
region: string,
authenticationType: string,
apiKey: string,
};
let appSyncConfig = {
graphqlEndpoint: "https://someendpointlslajfasflakjfa.appsync-api.eu-west-1.amazonaws.com/graphql",
region: "eu-west-1",
authenticationType: "API_KEY",
apiKey: "da2-dlfx2ilsuasfdsaf3mx73e7y",
};
};
This is the error:
>>>> Start compiling
Rebuilding since just get started
ninja: Entering directory `lib/bs'
[5/6] Building src/AWS/AppSyncConfig.mlast
FAILED: src/AWS/AppSyncConfig.mlast
/Users/prisc_000/.yarn/lib/node_modules/bs-platform/lib/bsc.exe -pp "/Users/prisc_000/.yarn/lib/node_modules/bs-platform/lib/refmt3.exe --print binary" -ppx '/Users/prisc_000/.yarn/lib/node_modules/bs-platform/lib/reactjs_jsx_ppx_2.exe' -w -30-40+6+7+27+32..39+44+45+101 -bs-suffix -nostdlib -I '/Users/prisc_000/code/APPSYNC/re-aws/node_modules/bs-platform/lib/ocaml' -bs-super-errors -no-alias-deps -color always -c -o src/AWS/AppSyncConfig.mlast -bs-syntax-only -bs-binary-ast -impl /Users/prisc_000/code/APPSYNC/re-aws/src/AWS/AppSyncConfig.re
File "/Users/prisc_000/code/APPSYNC/re-aws/src/AWS/AppSyncConfig.re", line 1, characters 1-2:
Warning 3: deprecated: ISO-Latin1 characters in identifiers
File "/Users/prisc_000/code/APPSYNC/re-aws/src/AWS/AppSyncConfig.re", line 1, characters 2-3:
Error: Illegal character (\187)
We've found a bug for you!
/Users/prisc_000/code/APPSYNC/re-aws/src/AWS/AppSyncConfig.re
There's been an error running Reason's refmt parser on a file.
This was the command:
/Users/prisc_000/.yarn/lib/node_modules/bs-platform/lib/refmt3.exe --print binary '/Users/prisc_000/code/APPSYNC/re-aws/src/AWS/AppSyncConfig.re' > /var/folders/dz/xzttny_14gs2lgxcvl5lm5680000gn/T/ocamlpp70e68f
Please file an issue on github.com/facebook/reason. Thanks!
ninja: error: rebuilding 'build.ninja': subcommand failed
>>>> Finish compiling(exit: 1)
This is the AwsAppSync binding, which may be wrong as well.
// AppSync.re
module AppSyncClient = {
[@bs.module "aws-appsync"] [@bs.new]
external linkClass : ReasonReact.reactClass = "AWSAppSyncClient";
let make =
(
~graphqlEndpoint: string,
~region: string,
~authenticationType: string,
~apiKey: string,
_children,
) => {
let props = {
"graphqlEndpoint": graphqlEndpoint,
"region": region,
"authenticationType": authenticationType,
"apiKey": apiKey,
};
ReasonReact.wrapJsForReason(~reactClass=linkClass, ~props, _children);
};
};
Called in index.re like so:
// index.re
...
let options = AppSyncConfig.appSyncConfig;
let client = AppSync.AppSyncClient(options);
Js.log("index.re ran");
ReactDOMRe.renderToElementWithId(
<ReasonApollo.Provider client>
<App message="Welcome to React and Reason" />
</ReasonApollo.Provider>,
"root",
);
Also, running yarn start
compiles(nothing in browser) but yarn watch
produces errors. What does that mean?
Feel free to be as elementary as you want/can.
Thank.