Automatic deploy fails on mobile builds

Priority: Medium
Request: Automatic deploy is returning Fail on mobile builds. In case is relevant the project started as Django web project and it was migrated to Mobile on early stage.
Project ID: myhelpa-15611
Project Link: https://myhelpa-15611.botics.co/
Staging Link:
Additional Info:
cc @amador.jesus @german.casas

@dmitrii.k @Crowdbotics_Dan any help on the above? :pray:

Hi @jorge.m, thanks for your post.

Here’s the output from your latest failed mobile build:

yarn install

yarn install v1.22.5
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
warning @react-native-community/async-storage@1.12.1: Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage
warning @react-native-community/async-storage > deep-assign@3.0.0: Check out `lodash.merge` or `merge-options` instead.
warning react-native-dotenv@0.2.0: critical bugs fixed in v2.2.0
warning react-devtools > electron > electron-download > nugget > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-devtools > electron > electron-download > nugget > request > har-validator@5.1.5: this library is no longer supported
[2/4] Fetching packages...
error https://registry.yarnpkg.com/morgan/-/morgan-1.9.1.tgz: Integrity check failed for "morgan" (computed integrity doesn't match our records, got "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA== sha1-Co0Wc0odmvvIJLmd+H5zjlji2lk=")
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Exited with code exit status 1

CircleCI received exit code 1

Perhaps refreshing the yarn.lock might fix the issue; and remove package-lock.json.

We already fix the previous problem, now we have a new one, image

@dmitrii.k @Crowdbotics_Dan we see this on the logs. Any clue?

[31mbundler: failed to load command: fastlane (/home/circleci/.rubies/ruby-2.6.1/bin/fastlane)[0m
FastlaneCore::Interface::FastlaneShellError: [31m[!] Exit status of command ‘/home/circleci/build/android/gradlew assembleRelease -p .’ was 1 instead of 0.

A push to this thread. Any help please? :pray:

@dmitrii.k can you help?

@jorge.m looks like the build is failing, have you tried building locally? any references/dependencies you have locally but forgot to add to any dependencies lists?

@german.casas @amador.jesus please review the build locally to check if there is something missing

@jorge.m the build locally its Okay, and this change was uploaded and it had an error again, this is the error :point_down: , and i create a new ticket for this Fail log in Automatic deploy mobile

the error log:

[18:08:32]: ▸ [35mSyntaxError: /home/circleci/build/src/utils/api/SessionApi.js: Try to import dotenv variable “API_URL” which is not defined in any .env files.[0m
[18:08:32]: ▸ [35merror src/utils/api/SessionApi.js: /home/circleci/build/src/utils/api/SessionApi.js: Try to import dotenv variable “API_URL” which is not defined in any .env files.[0m
[18:08:32]: ▸ [35m> 1 | import {API_URL} from ‘react-native-dotenv’;[0m
[18:08:32]: ▸ [35m| ^^^^^^^[0m
[18:08:32]: ▸ [35m> 1 | import {API_URL} from ‘react-native-dotenv’;[0m
[18:08:32]: ▸ [35m2 | import AsyncStorage from ‘@react-native-community/async-storage’;[0m
[18:08:32]: ▸ [35m| ^^^^^^^[0m
[18:08:32]: ▸ [35m3 | import {[0m
[18:08:32]: ▸ [35m4 | methods,[0m
[18:08:32]: ▸ [35m2 | import AsyncStorage from ‘@react-native-community/async-storage’;[0m

@jorge.m @dmitrii.k When I upload the project, the .env stays my local, I’m not sure how the document is created for the automatic build, or if it exists before doing the build, it’s necessary, my question is if this document exists at the time of do the build?

@beatriz.ramirez, thanks for your post and welcome to the forums!

.env is meant only for local development, so it’s OK that it’s not uploaded. You definitely need to remove the dotenv code from your production builds and keep it only in local.

Alternatively, you might want to create something like .env.production and use that for production builds. Or I can set CircleCI environment variables for you to the values you specify (so the proper environment is used for variables during production builds, instead of dotenv).

I’m not an expert in mobile development, perhaps @tony might suggest other ways to resolve your issue.

thanks @dmitrii.k, @tony do you have any suggestions that can help us set up a good environment for the automatic build ?

@tony a bit of help would be much appreciated here. Thanks in advance