Describe the bug
When generating a REST API via the amplify add api
command, the packager cannot be run again due to the following error:
Loading dependency graph...(node:18727) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
Duplicate module name: functionsendalertsms
Paths: /Users/kirkryan/Documents/dev/Native/amplify/backend/function/functionsendalertsms/src/package.json collides with /Users/kirkryan/Documents/dev/Native/amplify/#current-cloud-backend/function/functionsendalertsms/src/package.json
To Reproduce
Steps to reproduce the behaviour:
ampify add api
, select REST, edit lambda function and then amplify push
yarn start
to start packagerExpected behavior
Packager would start normally
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
AWS Amplify: 0.1.43 (the result of amplify version command)
node.js version: v10.1.0
Hello,
I have the same issue:
(node:39314) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
Duplicate module name: MedicosCRUDFunction
Paths: /Users/rlousada/Documents/Developer/react-native/awstest2/amplify/backend/function/MedicosCRUDFunction/src/package.json collides with /Users/rlousada/Documents/Developer/react-native/awstest2/amplify/#current-cloud-backend/function/MedicosCRUDFunction/src/package.json
with the following services added
| Category | Resource name | Operation | Provider plugin |
| -------- | ------------------- | --------- | ----------------- |
| Auth | cognito47ff28f4 | No Change | awscloudformation |
| Storage | BetterNow | No Change | awscloudformation |
| Function | MedicosCRUDFunction | No Change | awscloudformation |
| Api | BetterNow | No Change | awscloudformation |
Any particular solution?
Yeah a turns out you have to exclude one of the directories from the bundler - Fix is here: https://github.com/aws/awsmobile-cli/issues/172#issuecomment-410931468
we encountered this issue on a react-native ^0.61.x project after a amplify add function
command. Adding a resolver blacklist to the metro.config.js
:
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([/amplify\/#current-cloud-backend\/.*/]),
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
and restarting the process yarn start --reset-cache
with a cache reset eliminated the error
I have the exact same issue but sadly the above solution didn't work for me :(
The error message: Loading dependency graph...(node:18727) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
....
....
still shows. I will note that I could not find the metro.config.json file in my root, rather it was in this path: node_modules -> react native -> template -> metro.config.json
https://github.com/facebook/react-native/blob/0.59-stable/template/metro.config.js#L12-L13
I am also using react native 0.59, but just recently upgraded to 0.61.5
Any suggestions on the problem?
Most helpful comment
we encountered this issue on a react-native ^0.61.x project after a
amplify add function
command. Adding a resolver blacklist to themetro.config.js
:and restarting the process
yarn start --reset-cache
with a cache reset eliminated the error