Amplify multi-env setup causing my production build with wrong env access

0

Hi, I use amplify react native to build both ios and Android application. I created two environment branch on both git and amplify - dev and production. Recently I built my application and ran into a very strange problem.

  1. Login in user (cognito from production env)
  2. Query data ( api graphql from production env)
  3. Force close the app or logout and login again (this cognito username exist on both production and development env)
  4. Query data (api graphql from dev env)

As you can see from above, all the sudden my app switch to development environment even though the app build is intend for production. How is it possible to have mix env co-exist in my app? The way I handle env build is like this:

When working on dev environment:

  1. git commit to dev
  2. git push to dev
  3. amplify init or env checkout to dev
  4. amplify push (if any changes)
  5. build the dev image

When switch to production environment:

  1. git checkout master which is production env
  2. git merge dev to master which is production env
  3. git push to master which is production
  4. amplify env checkout to production env
  5. amplify push (if any changes)
  6. build the production image

The way I make sure my amplify environment setup switch to production is by checking inside the aws-exports.js file. And as I stated above, my first launch always points me correctly to the production server. Then how is it possible to switch from a production to a development server? Is there any place I missed causing such sudden switch?

I really hope to get feedback from the aws amplify development team. This issue is preventing my from launching my app to the store. It would be a disaster if I didn't run enough test before launch.

In addition, I suspect the config might be cache somewhere in the device during my development testing, but tried a brand new device and the problem persist. So that is not the case.

Thanks in advance for the support.

Edited by: rmwh6 on Aug 29, 2019 9:00 PM

Edited by: rmwh6 on Aug 29, 2019 9:01 PM

Edited by: rmwh6 on Aug 29, 2019 9:02 PM

Edited by: rmwh6 on Aug 29, 2019 9:05 PM

Edited by: rmwh6 on Aug 29, 2019 9:08 PM

Edited by: rmwh6 on Aug 29, 2019 9:09 PM

Edited by: rmwh6 on Aug 29, 2019 9:10 PM

rmwh6
質問済み 5年前482ビュー
1回答
0

The problem has nothing to do with Amplify env. Issue has been discussed in another thread. Closed.

rmwh6
回答済み 5年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン