-
Notifications
You must be signed in to change notification settings - Fork 825
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
[cli/@multi-dev] React Native metro bundler crashes on naming collision for rest endpoints #742
Comments
@timkuilman There's a workaround for this provided out here - amazon-archives/awsmobile-cli#172 (comment) Please take a look at this and let me know if you've any concerns regarding the approach |
I initially did add rn-cli.config.js to the root of my project with the following content.
This configuration leaded to another problem: the amplify node packages could no longer be bundled. I changed the configuration a bit to make it work:
For future reference: I came across https://stackoverflow.com/questions/41813211/how-to-make-react-native-packager-ignore-certain-directories describing how different versions of RN native require a slightly different rn-cli.config.js. I used the one for RN > 0.57. Thank you @kaustavghosh06 |
Thanks for this, I was getting this error for every single REST api that Amplify generates. |
Hi @kaustavghosh06, perhaps I don't understand how metro works very well, but does this mean that metro is trying to bundle backend code into the client application? If so, this seems like a serious problem. After all, how much sensitive data do people place in their backend code? Hi @timkuilman, amplify-cli creates two copies of your backend code, and metro was complaining about collisions between these two copies. I would recommend excluding the entire Anyone know how to get the full path of each file or module that metro is processing? |
Just an update on this. If you are using RN 0.60.0 or above then you need to add these two lines to your metro.config.js You are basically telling the metro bundler to ignore the #current-cloud-backend directory as it's simply a backup that amplify keeps track of locally and isn't used by your CLI.
Here's what the completed file should look like:
|
Hey, I did not work for me at all. I tried all the methods, Creating rn-cli.config.js file , and your this metero-config.js as well. Can anybody help me out with this??I am struggling for my FYP |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Describe the bug
I'm working on a passwordless authentication flow. For that reason I did add some new rest api resources to my react-native app via the amplify cli. After I pushed the new resources to the AWS my package refuses to start the app.
To Reproduce
Steps to reproduce the behavior:
I used the following flow to create the three lambda functions (createAuthChallenge, defineAuthChallenge and verifyAuthChallengeResponse)
-> amplify add api
-> Choose REST
-> Choose ' Create new Lambda Function'
-> Choose 'Serverless express function (Integration with Amazon API Gateway)'
After completing these (and some naming choosing steps) the packagers still starts. But when I run amplify push, the error pops up.
Expected behavior
I'd expect the react native metro bundler to start.
Screenshots
Smartphone (please complete the following information):
Additional context
I am using the multi env cli for amplify.
The text was updated successfully, but these errors were encountered: