question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scriptURL is null when building for Release with Xcode

See original GitHub issue

Current Behavior

When building with the release build configuration in Xcode, I’m getting the following build error:

Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: null is not an object (evaluating 't.match(/(^.+)\/index/)[1]')

The error is referring to the minified version of this line, so it seems that NativeModules.SourceCode.scriptURL being imported from react-native is null.

I’m getting this when using haul version 1.0.0-beta-12. With 1.0.0-beta-11, it works just fine (it doesn’t include the line that is causing the error).

Expected Behavior

The build should complete without error as it does in beta-11.

Haul Configuration (webpack.haul.js)

const eslintFormatter = require('react-dev-utils/eslintFormatter')
const paths = require('./paths')

module.exports = ({ platform }, defaults) => ({
  entry: `./index.js`,
  module: {
    ...defaults.module,
    rules: [
      ...defaults.module.rules,
      {
        test: /\.(js|jsx)$/,
        enforce: 'pre',
        use: [
          {
            options: {
              formatter: eslintFormatter,
            },
            loader: require.resolve('eslint-loader'),
          },
        ],
        include: paths.appSrc,
      },
      {
        test: /\.graphql$/,
        exclude: /node_modules/,
        loader: 'graphql-tag/loader',
      },
    ],
  },
})

Your Environment

software version
Haul 1.0.0-beta-12
react-native 0.52.0
node 8.9.4
npm or yarn yarn

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
satya164commented, Feb 12, 2018

Makes sense that scriptURL is not available in production. Changing global.DEV_SERVER_ORIGIN = scriptURL.match(/(^.+)\/index/)[1]; to global.DEV_SERVER_ORIGIN = scriptURL ? scriptURL.match(/(^.+)\/index/)[1] : null; should fix the issue. What do you think @zamotany ?

0reactions
czystylcommented, Feb 13, 2018

Not exactly because scriptUrl is always a string but regex not matched then we try to get [1] element form null and BOOM! I created PR to fix this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No script URL provided react native error - Apple Developer
Hello all, can't figure out the app crash it builds well and works in Debug mode, but in release modeit build but crashes...
Read more >
react-native: 'RCTFatalException: No script URL provided
I am answering my own question. My problem has been solved by generating jsBundle using this command: react-native bundle --dev false --assets-dest ....
Read more >
NULL Reference Exception in Xcode Build but not in Editor
However, when I build for iOS devices using Xcode and run the app, the variable "videoControlContainer" is always NULL.
Read more >
macOS Ventura: can't launch build terminal
“buildapp.sh” can't be opened because (null) is not allowed to open documents in Terminal. ... macOS Ventura: SAB 10.1.1 doesn't find Xcode.
Read more >
Managing Build Configurations in Xcode - Cocoacasts
A brand new Xcode project defines two build configurations, Debug and Release. Most projects define one ... 9, How to Encode Null Using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found