Reading ReasonReact Errors



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:

module AppSyncConfig = {
  type t = {
    graphqlEndpoint: string,
    region: string,
    authenticationType: string,
    apiKey: string,
  let appSyncConfig = {
    graphqlEndpoint: "",
    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/
File "/Users/prisc_000/code/APPSYNC/re-aws/src/AWS/", line 1, characters 1-2:
Warning 3: deprecated: ISO-Latin1 characters in identifiers
File "/Users/prisc_000/code/APPSYNC/re-aws/src/AWS/", line 1, characters 2-3:
Error: Illegal character (\187)

  We've found a bug for you!

  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/' > /var/folders/dz/xzttny_14gs2lgxcvl5lm5680000gn/T/ocamlpp70e68f

  Please file an issue on Thanks!

ninja: error: rebuilding '': subcommand failed
>>>> Finish compiling(exit: 1)

This is the AwsAppSync binding, which may be wrong as well.

module AppSyncClient = {
  [@bs.module "aws-appsync"] []
  external linkClass : ReasonReact.reactClass = "AWSAppSyncClient";
  let make =
        ~graphqlEndpoint: string,
        ~region: string,
        ~authenticationType: string,
        ~apiKey: string,
      ) => {
    let props = {
      "graphqlEndpoint": graphqlEndpoint,
      "region": region,
      "authenticationType": authenticationType,
      "apiKey": apiKey,
    ReasonReact.wrapJsForReason(~reactClass=linkClass, ~props, _children);

Called in like so:

let options = AppSyncConfig.appSyncConfig;

let client = AppSync.AppSyncClient(options);

Js.log(" ran");

  <ReasonApollo.Provider client>
    <App message="Welcome to React and Reason" />

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.


Answer is apparently the UTF-8 encoding value was changed some kind of way. Fixed it in vscode by changing UTF-8 BOM to UTF-8 and then saving with new encoding. Thanks @wegry on discord.