aws-sdk-react-native icon indicating copy to clipboard operation
aws-sdk-react-native copied to clipboard

Syntax error in AWSCognitoCredentials

Open yorickr opened this issue 9 years ago • 6 comments
trafficstars

I'm getting a syntax error on this line.

If I understand correctly, it's destructuring callbackId from event, then passing that on to the arrow function. However, is this the correct syntax? I've just updated to the latest React Native version, and it still gives me the error.

Would this fix it?

yorickr avatar Oct 27 '16 06:10 yorickr

+1

SyntaxError /Users/jschimmoeller/projects/eaddr/node_modules/aws-sdk-react-native-core/src/AWSCognitoCredentials.js: Unexpected token, expected , (48:57)

RCTFatal + 104 -[RCTBatchedBridge stopLoadingWithError:] + 1138 25-[RCTBatchedBridge start]_block_invoke_2 + 65 _dispatch_call_block_and_release + 12 _dispatch_client_callout + 8 _dispatch_main_queue_callback_4CF + 1054 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 __CFRunLoopRun + 2205 CFRunLoopRunSpecific + 420 GSEventRunModal + 161 UIApplicationMain + 159 main + 111 start + 1

jschimmoeller avatar Nov 06 '16 17:11 jschimmoeller

I changed the brackets {} to () and got by it:

  listener.addListener("LoginsRequestedEvent", async (callbackId) => {
    const logins = [await Promise.resolve(this.getLogins())];
    cognitoClient.sendCallbackResponse(callbackId, logins);
  });

jschimmoeller avatar Nov 06 '16 17:11 jschimmoeller

@jschimmoeller that doesn't destructure callbackId from the event though, so even though it's syntactically correct, it'll probably give you errors if it ever gets called.

yorickr avatar Nov 07 '16 00:11 yorickr

@yorickr Your code fixed this for me: https://github.com/yorickr/aws-sdk-react-native/commit/f9e7a26daaff8ca54db729068b9d71eae7314155

eddanger avatar Dec 06 '16 23:12 eddanger

@jschimmoeller that's how I fixed it. I didn't post a fix when I first encountered it because I thought it was my own babel issue.

Is AWS taking this project seriously? Doubtful, but hopeful.

willks avatar Dec 08 '16 04:12 willks

Sigh

kanerogers avatar Dec 12 '16 13:12 kanerogers