Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

presignup handler #1

Open
saneera opened this issue May 1, 2018 · 8 comments
Open

presignup handler #1

saneera opened this issue May 1, 2018 · 8 comments

Comments

@saneera
Copy link

saneera commented May 1, 2018

Hi
I m going to integrate only pre sign up handler and I m new to node and typescript

export const preSignUp = (newUser: SignUpUserEvent, context: any, callback: Callback) 
 and I got following error 
 Promise.resolve()
    .then(() => {  this line  what would be the cause


ERROR in ./pre-signup-lambda-integration/pre-signup-integration-request-function.ts
(12,11): error TS2345: Argument of type '() => Promise<PromiseResult<AdminLinkProviderForUserResponse, AWSError>> | undefined' is not assignable to parameter of type '((value: void) =>
PromiseResult<AdminLinkProviderForUserResponse, AWSError> | PromiseLike<Promise...'.
  Type '() => Promise<PromiseResult<AdminLinkProviderForUserResponse, AWSError>> | undefined' is not assignable to type '(value: void) => PromiseResult<AdminLinkProviderForUserResponse,
 AWSError> | PromiseLike<PromiseR...'.
    Type 'Promise<PromiseResult<AdminLinkProviderForUserResponse, AWSError>> | undefined' is not assignable to type 'PromiseResult<AdminLinkProviderForUserResponse, AWSError> | PromiseL
ike<PromiseResult<AdminLinkPr...'.
      Type 'undefined' is not assignable to type 'PromiseResult<AdminLinkProviderForUserResponse, AWSError> | PromiseLike<PromiseResult<AdminLinkPr...'.

  Error --------------------------------------------------
@dinvlad
Copy link
Member

dinvlad commented May 1, 2018

Could you provide a link to your code? Thanks

@dinvlad
Copy link
Member

dinvlad commented May 1, 2018

Sorry, I need more context. Could you link to a repo?

@saneera
Copy link
Author

saneera commented May 1, 2018

@dinvlad
Copy link
Member

dinvlad commented May 1, 2018

I think it has to do with your custom use of types in the lambda function. E.g., you import Callback from aws-lambda, whereas I use

export type Callback = (err?: Error | string, data?: any) => void;

Perhaps try to reuse the same types first, and then see where it fails if you'd like to start using alternative types.

@saneera
Copy link
Author

saneera commented May 2, 2018

I tried but still fails

@dinvlad
Copy link
Member

dinvlad commented May 2, 2018

I think it has to do strict type checking in your tsconfig.json, which prevents undefined and null from being used interchangeably. I did plan to update the code to be strict at some point, but not sure I have time for that now, unfortunately. I'd recommend either disabling strict type checking, or tracing down the errors where the output of one of the helper functions can be undefined. The error seems to be in this line https://github.com/saneera/presignup/blob/b287636401c492963e5ee0624bb9f07bdc8ad4ca/serverless/presignup/my_modules/pre-signup-lambda-integration/pre-signup-integration-request-function.ts#L24

@saneera
Copy link
Author

saneera commented May 2, 2018

Thanks very much
I did the change working fine it created two users google and native user with same sub
first time not logged in second time its working fine
its that normal ?

Thanks for your help again

@dinvlad
Copy link
Member

dinvlad commented May 2, 2018

Glad to hear it! I started experiencing the same problem ~ a month after writing that code. It appears to be an issue with AWS Cognito Auth service that's not yet resolved: https://forums.aws.amazon.com/thread.jspa?messageID=814706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants