Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase-crashlytics AND firebase-messaging] iOS app crashes upon launch #239

Closed
rdlauer opened this issue Jan 17, 2024 · 6 comments
Closed
Assignees
Labels
in progress question Further information is requested

Comments

@rdlauer
Copy link

rdlauer commented Jan 17, 2024

As the title suggests, after adding crashlytics and/or messaging to an iOS app, it crashes upon launch. This is easy to replicate:

  1. ns create myapp (I chose plain TS)
  2. npm install @nativescript/firebase-core and npm install @nativescript/firebase-crashlytics
  3. add the following to app.ts:
import { firebase } from '@nativescript/firebase-core'
import '@nativescript/firebase-crashlytics';
await firebase().initializeApp();
  1. update webpack.config.js to fix build issue:
webpack.mergeWebpack({resolve: {
	fallback: {
            'fs': false,
            'path': false,
            'path-browserify': false,
	}
}})
  1. ns run ios --> simulator boots and crashes without error message
@NathanWalker
Copy link
Contributor

Hi @rdlauer have you downloaded the GoogleService-Info.plist from firebase and placed inside App_Resources/iOS by chance?

@NathanWalker NathanWalker self-assigned this Jan 17, 2024
@NathanWalker NathanWalker added in progress question Further information is requested labels Jan 17, 2024
@rdlauer
Copy link
Author

rdlauer commented Jan 17, 2024

Yeah I did that as well (forgot to add it to my list of steps above!)

@NathanWalker
Copy link
Contributor

NathanWalker commented Jan 17, 2024

Do you happen to have the stack you see by chance? It could just be order of operations in how the init is setup as I don't see that here.

For example, with this setup I don't see what's described (and also see no webpack complaints - meaning no webpack config changes should be needed).

import { Application, ApplicationEventData } from '@nativescript/core';
import { firebase } from '@nativescript/firebase-core';
import '@nativescript/firebase-crashlytics';

Application.on(Application.launchEvent, async (args: ApplicationEventData) => {
  await firebase().initializeApp().then(async() => {
    const crashlytics = firebase().crashlytics();

    if (crashlytics.checkForUnsentReports()) {
      crashlytics.log('Sending unsent crash reports...');
      crashlytics.sendUnsentReports();
    }
  });

// bootstrap app, eg:
runNativeScriptAngularApp({
  appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule)
});

Possible to share the package.json by chance, would be curious there?

@rdlauer
Copy link
Author

rdlauer commented Jan 17, 2024

Hi @NathanWalker - thanks again for helping out here. I just created a new app and used your init code above...and it works! I've got a few notes here on little doc updates and will wrap these up in a PR soon.

FYI I DID still have to update the webpack config due to this error:

ERROR in ./node_modules/source-map/lib/read-wasm.js 30:15-30
Module not found: Error: Can't resolve 'path' in '/Users/roblauer/Documents/apps/fbtest/node_modules/source-map/lib'

@rdlauer rdlauer closed this as completed Jan 17, 2024
@NathanWalker
Copy link
Contributor

If get a chance later, sharing the package.json would be interesting to see if something in there leads to the config issue (have not seen that before - using node 20.10.0 here).

@rdlauer
Copy link
Author

rdlauer commented Jan 17, 2024

Yeah no problem. I'm on node 20.11.

{
  "name": "myapp",
  "main": "app/app.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@nativescript-community/ui-material-floatingactionbutton": "^7.2.29",
    "@nativescript-community/ui-pulltorefresh": "^2.5.3",
    "@nativescript/background-http": "^6.0.0",
    "@nativescript/camera": "^5.1.1",
    "@nativescript/core": "~8.6.2",
    "@nativescript/datetimepicker": "^2.1.13",
    "@nativescript/geolocation": "^8.3.1",
    "@nativescript/haptics": "^3.0.2",
    "@nativescript/imagepicker": "^3.0.1",
    "@nativescript/iqkeyboardmanager": "^2.1.1",
    "@nativescript/theme": "~3.0.2",
    "@nstudio/nativescript-fluid-segmented-bar": "^1.0.2",
    "@nstudio/nativescript-loading-indicator": "^4.3.4",
    "@triniwiz/nativescript-image-cache-it": "^7.4.0",
    "@triniwiz/nativescript-star-ratings": "^2.0.3",
    "email-validator": "^2.0.4",
    "just-clone": "^6.2.0",
    "libphonenumber-js": "^1.10.53",
    "nativescript-carousel": "^7.0.1",
    "nativescript-drop-down": "^6.0.2",
    "throttle-debounce": "^5.0.0"
  },
  "devDependencies": {
    "@nativescript/android": "8.6.2",
    "@nativescript/ios": "8.6.3",
    "@nativescript/types": "~8.6.1",
    "@nativescript/webpack": "~5.0.18",
    "@types/throttle-debounce": "^5.0.2",
    "typescript": "~5.3.3"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants