-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
TypeORM breaks in Serverless Framework Webpack #8714
Comments
@giladgd thanks for the swift response! Still getting the same error as above - that being said for your information I am using serverless-bundle (https://github.com/AnomalyInnovations/serverless-bundle) as my webpack bundler. I setup a repro repo and will try to exclude typeorm from the serverless bundling and see if that is a temporary workaround. |
@mkilp Can you please provide me with an example repo to reproduce the issue locally? |
@giladgd https://github.com/mkilp/typeorm-webpack-bug here you go. Thanks! |
@mkilp Since you're using Webpack without the default |
Hi, Not sure if it is exactly the same problem, but I was having the same issue, albeit in a different setup. What I have is a server-side database defined with TypeORM, types are declared in a "shared" folder used for server-side AND client-side type consistency. Client-side is going through webpack for bundling. No database manipulation is done client-side, types are only used to get a consistent type checking between server and client. Since 0.2.42, importing the types client-side lead to webpack complaining the typeorm import failed, and at runtime the same "Cannot destructure property 'ConnectionOptionsReader" error. What I ended up doing was adding an alias in my webpack configuration:
Don't know if it is the right workaround or not, but at least it got me going... Regards, |
I also encounter this bug with serverless framework and also using serverless-bundle. Here is my configuration to alias typeorm and get the browser dist code to be able to bundle it for Lambda functions:
Note: you need to put the path to your node_modules (I am in an Nx monorepo and the package is in 3 subfolders). You could just set Hope this helps. |
I faced almost the same problem with @mkilp . There the problem seems invocation at |
I am facing same issue and it got resolve with help of aliases: |
I used esbuild to bundle functions instead of webpack. |
For me it worked with an alias like mentioned in the comments. Thanks everyone! |
Hi everyone. I tried the suggestion with the
Does anyone have any idea why the |
If I check the bundled file, it has this line:
If I comment out the line where it This feels super weird -- wonder how that got in there and if anyone knows a feasible way to disable/remove that line without needing me to modify the bundled file. Thanks! |
Found a way around that. Downgrade our |
Issue Description
TypeORM does not seems to play well while being used in a Serverless Framework application. I'm trying to use it in a Lambda environment to handle all my db things. Error seems to happen after version 0.2.42. I would look into it myself, but I'm sadly not that familiar with the whole webpack world. As being asked in the other issue. Tagging @giladgd as instructed in #8689.
Expected Behavior
TypeORM works fine inside Webpack and Serverless Framework
Actual Behavior
(Own PC paths are redacted and replaced by "SourceRoot")
Steps to Reproduce
My Environment
Relevant Database Driver(s)
aurora-data-api
aurora-data-api-pg
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: