Linking requires a build-time setting `scheme` in the project’s Expo config

🐛 Bug Report

Summary of Issue

I’m using expo-linking v2.1.1 and trying to call createURL. However, I’m getting the following error when I try to run a simple test that just renders the app (code is in the Steps to Reproduce):

Linking requires a build-time setting 'scheme' in the project's Expo config (app.config.js or app.json) for bare or production apps.

My scheme is already defined in app.json.

The only way I can suppress this error is by passing my scheme again when I call createURL. When I do this and I eject, though, I get another error:

The provided linking scheme does not appear in the list of possible uri schemes in your expo config

Even though the scheme that it prints out is encapsulated within the list of schemes it says it should match.

So I think for some reason it’s just not recognizing the scheme that’s defined in the app.json.

Environment – output of expo diagnostics & the platform(s) you’re targeting

Expo CLI 4.1.0 environment info:
    System:
      OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver)
      Shell: 4.4.20 - /bin/bash
    Binaries:
      Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
      Yarn: 1.22.5 - /mnt/c/Program Files (x86)/Yarn/bin/yarn
      npm: 6.14.10 - ~/.nvm/versions/node/v14.15.0/bin/npm
    npmPackages:
      expo: ^40.0.1 => 40.0.1
      react: ^17.0.1 => 17.0.1
      react-dom: ^17.0.1 => 17.0.1
      react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2
      react-native-web: ^0.14.8 => 0.14.10
    npmGlobalPackages:
      expo-cli: 4.1.0
    Expo Workflow: managed

Reproducible example

https://github.com/churichard/expo-linking-bug

Steps to Reproduce

Clone the repo, run yarn install, then run yarn test. The warning should show up when the App.test.tsx test is run.

Expected Behavior vs Actual Behavior

This warning should not appear if scheme is already defined in app.json.

1 possible answer(s) on “Linking requires a build-time setting `scheme` in the project’s Expo config