EAS build suddenly fails on Workers build step.

Yesterday my build ran fine but today it’s not running so well… Wondering if anyone is experiencing the same issue.

expo-cli 4.1.6
expo 40.0.0
Managed Tabs project but literally only created yesterday so it's bare bones

command

 "build:testing": "eas build --profile staging --platform all",

eas.json

{
  "builds": {
    "android": {
      "release": {
        "workflow": "managed"
      },
      "staging": {
        "distribution": "internal",
        "releaseChannel": "staging",
        "workflow": "managed"
      }
    },
    "ios": {
      "release": {
        "workflow": "managed"
      },
      "staging": {
        "distribution": "internal",
        "releaseChannel": "staging",
        "workflow": "managed"
      }
    }
  }
}

app.config.js

import 'dotenv/config';

export default {
    expo: {
      name: 'App',
      slug: 'App',
      version: '1.0.0',
      owner: 'companyname',
      orientation: 'portrait',
      icon: './assets/images/icon.png',
      scheme: 'myapp',
      userInterfaceStyle: 'automatic',
      splash: {
        image: './assets/images/testplashcreengif.gif',
        resizeMode: 'cover',
        backgroundColor: '#74d693',
      },
      updates: {
        fallbackToCacheTimeout: 0,
      },
      assetBundlePatterns: [
        '**/*',
      ],
      ios: {
        supportsTablet: true,
        bundleIdentifier: 'com.company.App',
        googleServicesFile: './GoogleService-Info.plist',
      },
      android: {
        adaptiveIcon: {
          foregroundImage: './assets/images/adaptive-icon.png',
          backgroundColor: '#FFFFFF',
        },
        package: 'com.company.App',
        googleServicesFile: './google-services.json',
      },
      web: {
        favicon: './assets/images/favicon.png',
      },
      extra: {
        ...process.env,
      },
    }
  }

output

Tue, 02 Feb 2021 21:52:46 GMT
Starting build
Tue, 02 Feb 2021 21:52:46 GMT
Download project archive
Tue, 02 Feb 2021 21:52:46 GMT
Unpacking project archive
Tue, 02 Feb 2021 21:52:46 GMT
Running yarn in the root dir of your repository 
Tue, 02 Feb 2021 21:52:47 GMT
yarn install v1.22.10
Tue, 02 Feb 2021 21:52:47 GMT
[stderr] warning ../../package.json: No license field
Tue, 02 Feb 2021 21:52:47 GMT
[1/4] Resolving packages...
Tue, 02 Feb 2021 21:52:47 GMT
[2/4] Fetching packages...
Tue, 02 Feb 2021 21:53:18 GMT
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
Tue, 02 Feb 2021 21:53:18 GMT
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
Tue, 02 Feb 2021 21:53:18 GMT
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
Tue, 02 Feb 2021 21:53:18 GMT
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
Tue, 02 Feb 2021 21:53:18 GMT
[3/4] Linking dependencies...
Tue, 02 Feb 2021 21:53:38 GMT
[4/4] Building fresh packages...
Tue, 02 Feb 2021 21:56:35 GMT
Done in 228.22s.
Tue, 02 Feb 2021 21:56:35 GMT
Ejecting managed project
Tue, 02 Feb 2021 21:56:36 GMT
Tue, 02 Feb 2021 21:56:36 GMT
[stderr] [21:56:36] Cannot destructure property 'code' of 'babel.transformFileSync(...)' as it is null.
Tue, 02 Feb 2021 21:56:36 GMT
[stderr] [21:56:36]     ├─ readConfigFile /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/@expo/config/src/getConfig.ts:22:21
Tue, 02 Feb 2021 21:56:36 GMT
[stderr]     ├─ getDynamicConfig /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/@expo/config/src/getConfig.ts:30:18
Tue, 02 Feb 2021 21:56:36 GMT
[stderr]     ├─ getConfig /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/@expo/config/src/Config.ts:163:62
Tue, 02 Feb 2021 21:56:36 GMT
[stderr]     ├─ actionAsync /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/expo-cli/src/commands/eject.ts:31:19
Tue, 02 Feb 2021 21:56:36 GMT
[stderr]     ├─ /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/expo-cli/src/exp.ts:674:12
Tue, 02 Feb 2021 21:56:36 GMT
[stderr]     └─ expo eject /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/expo-cli/src/exp.ts:346:13
Tue, 02 Feb 2021 21:56:36 GMT
Build failed: node exited with non-zero code: 1

Managed Tabs project but literally only created yesterday so it’s bare bones

does this mean you literally have not modified it at all? if you have, we’d need to know more information to help. it looks like you’ve added some babel config

@notbrent
The only thing i have been doing to the code-base are:

  • Adding .env
  • created a utility functions directory with a getENV func within it
  • installing dotenv
  • editing the app.config.js
  • adding the eas.json

babel config is untouched

this is my getENV method

import Constants from 'expo-constants';

type Options = {
    noOS?: boolean,
    noFlavor?: boolean,
}

export function get(key: string, opts?: Options) {
    if (!key) return Constants.manifest.extra;

    const isIOS = 'ios' in (Constants.platform || {});
    const OSKey = isIOS ? '_IOS' : '_ANDROID';
    let FlavorKey = '';

    const releaseChannel = Constants.manifest.releaseChannel;
    switch (releaseChannel) {
        case 'release':
            break;
        case 'staging':
            FlavorKey = '_STAGING';
            break;
        default:
            FlavorKey = '_DEV';
            break;
    }

    const curatedKey = `${key}${(opts || {}).noOS ? '' : OSKey}${(opts || {}).noFlavor ? '' : FlavorKey}`;

    return Constants.manifest.extra[curatedKey] || undefined;
}

export function getExact(key: string) {
    if (!key) return process.env;

    return process.env[key] || undefined;
}

babel.config.js

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
  };
};

package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test": "jest --watchAll",
    "build:testing": "eas build --profile staging --platform all",
    "build:testing:android": "eas build --profile staging --platform android",
    "build:testing:ios": "eas build --profile staging --platform ios",
    "register:ios": "eas device:create"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^12.0.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-navigation/bottom-tabs": "5.11.2",
    "@react-navigation/native": "~5.8.10",
    "@react-navigation/stack": "~5.12.8",
    "dotenv": "^8.2.0",
    "expo": "~40.0.0",
    "expo-asset": "~8.2.1",
    "expo-constants": "~9.3.0",
    "expo-firebase-analytics": "~2.6.0",
    "expo-font": "~8.4.0",
    "expo-linking": "~2.0.0",
    "expo-splash-screen": "~0.8.0",
    "expo-status-bar": "~1.0.3",
    "expo-web-browser": "~8.6.0",
    "firebase": "7.9.0",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-gesture-handler": "~1.8.0",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "~2.15.0",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "@types/react": "~16.9.35",
    "@types/react-native": "~0.63.2",
    "jest-expo": "~40.0.0",
    "typescript": "~4.0.0"
  },
  "private": true
}

I have noticed that babel-preset-expo is not in any dependancy list though…

my guess is that dotenv is expecting a .env file to exist and then throwing some error when it doesn’t (because you probably don’t commit it to git?)

if you can share a How to create a Minimal, Reproducible Example - Help Center - Stack Overflow we can investigate further but i am confident that there is a problem in your project.

I have noticed that babel-preset-expo is not in any dependancy list though…

it is included as a dependency of the expo package (run yarn why babel-preset-expo to see that)

@notbrent Appreciate your help on this. if you are able to give me an email address i can add you to my repo.

At the moment EAS seems fairly limited with regards to being able to keep secrets on the project in a .env i have moved my credentials into a ENV.ts file to see if that helps.
You’re right i have a number of files that are .gitignore'd and the EAS build was struggling to find them.

Some of these files are my google-services files which i need to have ignored…

Have you a workaround for referencing files when building with EAS? or is this something that is coming down the pipeline soon.

What i require and probably what others require is the ability to easily define build-flavor .env files e.g .env.staging | .env.development | .env.production etc aswell as run an EAS build wiht ignored files.

IOS build working now but Android still failing

Wed, 03 Feb 2021 20:56:49 GMT
Starting build
Wed, 03 Feb 2021 20:56:49 GMT
Download project archive
Wed, 03 Feb 2021 20:56:50 GMT
Unpacking project archive
Wed, 03 Feb 2021 20:56:50 GMT
Running yarn in the root dir of your repository 
Wed, 03 Feb 2021 20:56:50 GMT
yarn install v1.22.10
Wed, 03 Feb 2021 20:56:50 GMT
[stderr] warning ../../package.json: No license field
Wed, 03 Feb 2021 20:56:50 GMT
[1/4] Resolving packages...
Wed, 03 Feb 2021 20:56:51 GMT
[2/4] Fetching packages...
Wed, 03 Feb 2021 20:57:22 GMT
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
Wed, 03 Feb 2021 20:57:22 GMT
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
Wed, 03 Feb 2021 20:57:22 GMT
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
Wed, 03 Feb 2021 20:57:22 GMT
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
Wed, 03 Feb 2021 20:57:22 GMT
[3/4] Linking dependencies...
Wed, 03 Feb 2021 20:57:44 GMT
[4/4] Building fresh packages...
Wed, 03 Feb 2021 21:00:35 GMT
Done in 224.80s.
Wed, 03 Feb 2021 21:00:35 GMT
Ejecting managed project
Wed, 03 Feb 2021 21:00:36 GMT
Wed, 03 Feb 2021 21:00:36 GMT
[stderr] [21:00:36] Cannot destructure property 'code' of 'babel.transformFileSync(...)' as it is null.
Wed, 03 Feb 2021 21:00:36 GMT
[stderr] [21:00:36]     ├─ readConfigFile /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/@expo/config/src/getConfig.ts:22:21
Wed, 03 Feb 2021 21:00:36 GMT
[stderr]     ├─ getDynamicConfig /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/@expo/config/src/getConfig.ts:30:18
Wed, 03 Feb 2021 21:00:36 GMT
[stderr]     ├─ getConfig /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/@expo/config/src/Config.ts:163:62
Wed, 03 Feb 2021 21:00:36 GMT
[stderr]     ├─ actionAsync /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/expo-cli/src/commands/eject.ts:31:19
Wed, 03 Feb 2021 21:00:36 GMT
[stderr]     ├─ /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/expo-cli/src/exp.ts:674:12
Wed, 03 Feb 2021 21:00:36 GMT
[stderr]     └─ expo eject /usr/local/lib/node_modules/@expo/eas-build-worker/node_modules/expo-cli/src/exp.ts:346:13
Wed, 03 Feb 2021 21:00:36 GMT
Build failed: node exited with non-zero code: 1