-
Notifications
You must be signed in to change notification settings - Fork 308
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
Issue initializing auth0 with Typescript and Inversify #863
Comments
HI @neeraj87 - thanks for raising this I have an example repo using serverless-bundle to bundle a project with node-auth0@3.4.0 and it appears to be working AnomalyInnovations/serverless-nodejs-starter@master...adamjmcgrath:serverless-nodejs-starter:master Could you share a minimal reproduction that demonstrates your issue and I'd be happy to debug it for you. |
Hey @adamjmcgrath, the issues seems to be happening when using inversify with auth0. I will create a minimal reproduction for you and share it here in some time. |
@adamjmcgrath Here is the minimal project file you can deploy on your lambda. You will need to add these 2 things
I deployed this project using AWS Codebuild and tested it and it is failing and showing the same error I mentioned above. However it works perfectly locally. Do let me know if you need any more information to help you debug/investigate. |
@adamjmcgrath - any updates on this? |
Hi @neeraj87 - I don't have an AWS account so I'm unable to test this on Cloudbuild. Are you not able to reproduce this locally? |
Hey @adamjmcgrath, no this is not reproducible on local. The issue was initially limited to our staging env but now seems to have spilled into production. Is there a way we can sync up separately and discuss? A lot of our services rely on auth0 service and have started to fail one by one |
@neeraj87 if you need to reach out to us directly you should be able to do this through your technical account manager or representative at auth0. The ESM support doesn't support all use cases, if this is the case with you, you should try importing the CJS version of this library using the workaround here #832 (comment) |
Closing as I believe #863 (comment) answers your question |
@adamjmcgrath yes you can close this. I actually managed to make this work by moving the auth0 dependency under bundle for my serverless.yml file as mentioned here Thank you for your help. |
Checklist
Description
I have a backend project running on AWS Lambda with Node.js and TypeScript. I am using serverless framework - more specifically serverless-bundle with inversify
The problem is auth0 does not initializes with inversify. This was a not a problem before but has suddenly started happening across all my projects wherever auth0 is being used.
I had raised another issue #815 with auth0 and even updated my project's auth0 version to latest one but it still fails.
Since the inversify container is being initialized from lambda, auth0 failure is causing the entire lambda failure for the project.
Reproduction
My lambda handler
In the above lambda handler one line number 3, I am initializing my express server, which looks like the following
in the express code above, I am setting the inversify container from
container-factory
which looks like thisin the code above I am importing the interfaces and services and binding them. You can see that I am also binding my auth0 service - which is where the problem starts.
The auth0 service looks like this (have removed the functions for readability)
I get this kind of error when the lambda function is called
If I comment the auth0 function binding in my
container-factory
then my lambda runs smoothly.Here are the dependencies and dev-dependencies in my project
Additional context
My lambda is running on Node.js version 14
node-auth0 version
3.4.0
Node.js version
14
The text was updated successfully, but these errors were encountered: