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

Generating REST API and Function via Amplify Add API results in naming collision #1144

Closed
kirkryan opened this issue Mar 28, 2019 · 5 comments
Labels
documentation Add or update documentation functions Issues tied to the functions category investigating This issue is being investigated

Comments

@kirkryan
Copy link

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:

  1. Run ampify add api, select REST, edit lambda function and then amplify push
  2. Run yarn start to start packager
  3. See error

Expected behavior
Packager would start normally

Desktop (please complete the following information):

  • OS: macOS Mojave 10.14.3
  • Browser Chrome
  • Version 73.0.3683.86

Smartphone (please complete the following information):

  • Device: iPhone XS
  • OS: iOS 12.1.4
  • Browser Safari

Additional context
AWS Amplify: 0.1.43 (the result of amplify version command)
node.js version: v10.1.0

@powerful23 powerful23 transferred this issue from aws-amplify/amplify-js Mar 28, 2019
@UnleashedMind UnleashedMind added functions Issues tied to the functions category investigating This issue is being investigated documentation Add or update documentation labels Mar 29, 2019
@ricardolousada
Copy link

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?

@kirkryan
Copy link
Author

Yeah a turns out you have to exclude one of the directories from the bundler - Fix is here: amazon-archives/awsmobile-cli#172 (comment)

@melodymorgan
Copy link

melodymorgan commented Nov 26, 2019

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

@Chipzstar
Copy link

Chipzstar commented Jan 11, 2020

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?

@github-actions
Copy link

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 *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Add or update documentation functions Issues tied to the functions category investigating This issue is being investigated
Projects
None yet
Development

No branches or pull requests

5 participants