node.jsreact-nativeaws-amplifyaws-amplify-cliexpo-web

Module not found: Error: Can't resolve '../aws-exports' (React-Native Expo Web)


I've developed an app which works perfectly when I run it through expo start --tunnel and then the w key for expo web.

In order to deploy it, I have tried to use the Amplify console, which seemed to work. However, while deploying the app, it has halted with the following messages:

2020-02-10T16:39:57.658Z [WARNING]: <s> [webpack.Progress] 70% building 41/59 modules 18 active /root/.nvm/versions/node/v10.16.0/lib/node_modules/expo-cli/node_modules/babel-loader/lib/index.js??ref--5-oneOf-2!/codebuild/output/src261112836/src/gmpmgr2v/node_modules/expo/build/Notifications/ExponentNotifications.web.js
2020-02-10T16:39:57.661Z [WARNING]: [16:39:57]  web  Failed to compile.
2020-02-10T16:39:57.661Z [WARNING]: [16:39:57]
2020-02-10T16:39:57.662Z [WARNING]: [16:39:57] Module not found: Error: Can't resolve '../aws-exports' in '/codebuild/output/src261112836/src/gmpmgr2v/src/modules'
2020-02-10T16:39:57.662Z [WARNING]: [16:39:57] Set EXPO_DEBUG=true in your env to view the stack trace.
2020-02-10T16:39:57.673Z [ERROR]: !!! Build failed
2020-02-10T16:39:57.674Z [ERROR]: !!! Non-Zero Exit Code detected
2020-02-10T16:39:57.674Z [INFO]: # Starting environment caching...
2020-02-10T16:39:57.674Z [INFO]: # Environment caching completed

I don't believe there is an issue with my aws-config file, otherwise I would not be able to run it through the expo start --tunnel command.

I believe it is probably not copying aws-config.js to somewhere it should while creating the build.

Has anyone had this problem as well, or know how to address it?


Solution

  • For some reason, in the case of this app, a relative reference to aws-exports file did not work, by using the two dots. Changing to a direct path did the job.