Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

[Crashlytics] How can we get a better stack trace?

Aberta
#94 5 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
25/100
Tipo de issue
Funcionalidade
Clareza
Precisa de esclarecimento
Status de atividade
Estagnada
Stack de tecnologia
android, ios, typescript

Direção de pesquisa

A issue menciona os comandos de release, o fluxo de arquivamento/upload do Xcode, o upload para o Google Play e vários stack traces do Crashlytics, mas não inclui arquivos do repositório nem testes. Comece examinando como os builds de release e os relatórios do Crashlytics estão integrados para iOS e Android e, em seguida, defina qual localização no código-fonte e quais informações legíveis do stack devem estar presentes em um relatório bem-sucedido.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

enhancement

As the title asks, is there a better way for us to build the app, or use the Crashlytics plugin, so that we can get a more readable and understandable stack trace?

We build the release like this

ns prepare ios --release --clean --env.production --env.aot --env.uglify

Then perform the archive and upload to AppStore via Xcode.

ns build android --release --clean --env.production --env.aot --env.uglify

Then upload apk to Google Play

I assume most of my issues are connected to the code being minified/uglified, but this is also the recommended way for performance, right?

ns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.2.3 version and is up to date.
✔ Component @nativescript/core has 8.2.5 version and is up to date.
⚠ Update available for component @nativescript/ios. Your current version is 8.2.3 and the latest available version is 8.3.0.
⚠ Update available for component @nativescript/android. Your current version is 8.2.3 and the latest available version is 8.2.4.

This is an example of a recent crash containing a stack trace from an app I'm working on. It is fairly simple to see what is causing the crash, but it's not so easy to see from where it's happening. I assume this is because of the minification process.

We can see it happens in a templateSelector (I guess that method was not minified due to being used in a template?), and that it's the accessing of the templateKey that fails, probably because the list item is null/undefined for some reason.
Luckily for us we don't have many of those, so we can go through every one, check them, log more error info and add an NPE guard to avoid the crash.

Unfortunately, this is probably one of the most descriptive error messages we've gotten.

Fatal Exception: NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'templateKey' of undefined
 at 
	templateSelector(file:///var/containers/Bundle/Application/E36----3B2/nsapp.app/app/bundle.js:1:290879)
	at _getItemTemplate(file:///var/containers/Bundle/Application/E36----3B2/nsapp.app/app/vendor.js:2:664680)
	at (file:///var/containers/Bundle/Application/E36----3B2/nsapp.app/app/vendor.js:2:667899)

0  CoreFoundation                 0x99288 __exceptionPreprocess
1  libobjc.A.dylib                0x16744 objc_exception_throw
2  NativeScript                   0xdbb70 tns::NativeScriptException::OnUncaughtError(v8::Local<v8::Message>, v8::Local<v8::Value>) + 63 (NativeScriptException.mm:63)
3  NativeScript                   0x45a968 v8::internal::MessageHandler::ReportMessageNoExceptions(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::Object>, v8::Local<v8::Value>)
4  NativeScript                   0x45a7d4 v8::internal::MessageHandler::ReportMessage(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::JSMessageObject>)
5  NativeScript                   0x39b53c v8::internal::Isolate::ReportPendingMessages()
6  NativeScript                   0x2f3d28 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&)
7  NativeScript                   0x2f32dc v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*)
8  NativeScript                   0x146780 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*)
9  NativeScript                   0x1ff90 tns::ArgConverter::MethodCallback(ffi_cif*, void*, void**, void*) + 171 (ArgConverter.mm:171)
10 NativeScript                   0x111264 ffi_closure_SYSV_inner
11 NativeScript                   0x1141b4 .Ldo_closure
12 UIKitCore                      0x2866c4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:]
13 UIKitCore                      0x483af0 -[UITableView _updateVisibleCellsForRanges:createIfNecessary:]
14 UIKitCore                      0x2ab8bc -[UITableView _updateVisibleCellsNow:]
15 UIKitCore                      0x17bd10 -[UITableView layoutSubviews]
16 UIKitCore                      0x18bfb4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
17 QuartzCore                     0x40cd0 CA::Layer::layout_if_needed(CA::Transaction*)
18 QuartzCore                     0x33134 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
19 QuartzCore                     0x47a7c CA::Context::commit_transaction(CA::Transaction*, double, double*)
20 QuartzCore                     0x50970 CA::Transaction::commit()
21 QuartzCore                     0x3288c CA::Transaction::flush_as_runloop_observer(bool)
22 UIKitCore                      0x53e198 _UIApplicationFlushCATransaction
23 UIKitCore                      0x7d897c _UIUpdateSequenceRun
24 UIKitCore                      0xe5ec48 schedulerStepScheduledMainSection
25 UIKitCore                      0xe5e410 runloopSourceCallback
26 CoreFoundation                 0xbb414 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
27 CoreFoundation                 0xcc1a0 __CFRunLoopDoSource0
28 CoreFoundation                 0x5694 __CFRunLoopDoSources0
29 CoreFoundation                 0xb05c __CFRunLoopRun
30 CoreFoundation                 0x1ebc8 CFRunLoopRunSpecific
31 GraphicsServices               0x1374 GSEventRunModal
32 UIKitCore                      0x514648 -[UIApplication _run]
33 UIKitCore                      0x295d90 UIApplicationMain
34 NativeScript                   0x114044 ffi_call_SYSV
35 NativeScript                   0x110ac8 ffi_call_int
36 NativeScript                   0xb39dc tns::Interop::CallFunctionInternal(tns::MethodCall&) + 1444 (Interop.mm:1444)
37 NativeScript                   0x7665c std::__1::__function::__func<tns::MetadataBuilder::CFunctionCallback(v8::FunctionCallbackInfo<v8::Value> const&)::$_2, std::__1::allocator<tns::MetadataBuilder::CFunctionCallback(v8::FunctionCallbackInfo<v8::Value> const&)::$_2>, void ()>::operator()() + 849 (MetadataBuilder.mm:849)
38 NativeScript                   0xd6c04 tns::Tasks::Drain() + 1739 (vector:1739)
39 NativeScript                   0xd0fd0 -[NativeScript initWithConfig:] + 64 (NativeScript.mm:64)
40 nsapp                  0x4c44 main + 59 (main.m:59)
41 ???                            0x102e71ce4 (Missing)

Here's a another set other reports that are flat out impossible to understand:

Fatal Exception: NativeScript encountered a fatal error: Uncaught TypeError: number 0 is not a function
 at 

0  CoreFoundation                 0x9904c __exceptionPreprocess
1  libobjc.A.dylib                0x15f54 objc_exception_throw
2  NativeScript                   0xdbb70 tns::NativeScriptException::OnUncaughtError(v8::Local<v8::Message>, v8::Local<v8::Value>) + 63 (NativeScriptException.mm:63)
3  NativeScript                   0x45a968 v8::internal::MessageHandler::ReportMessageNoExceptions(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::Object>, v8::Local<v8::Value>)
4  NativeScript                   0x45a7d4 v8::internal::MessageHandler::ReportMessage(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::JSMessageObject>)
5  NativeScript                   0x39b53c v8::internal::Isolate::ReportPendingMessages()
Fatal Exception: NativeScript encountered a fatal error: Uncaught TypeError: number -62295433 is not a function
 at 

0  CoreFoundation                 0x99288 __exceptionPreprocess
1  libobjc.A.dylib                0x16744 objc_exception_throw
2  NativeScript                   0xdbb70 tns::NativeScriptException::OnUncaughtError(v8::Local<v8::Message>, v8::Local<v8::Value>) + 63 (NativeScriptException.mm:63)
3  NativeScript                   0x45a968 v8::internal::MessageHandler::ReportMessageNoExceptions(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::Object>, v8::Local<v8::Value>)
4  NativeScript                   0x45a7d4 v8::internal::MessageHandler::ReportMessage(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::JSMessageObject>)
5  NativeScript                   0x39b53c v8::internal::Isolate::ReportPendingMessages()
Fatal Exception: NativeScript encountered a fatal error: Uncaught TypeError: object is not a function
 at 

0  CoreFoundation                 0x99288 __exceptionPreprocess
1  libobjc.A.dylib                0x16744 objc_exception_throw
2  NativeScript                   0xdbb70 tns::NativeScriptException::OnUncaughtError(v8::Local<v8::Message>, v8::Local<v8::Value>) + 63 (NativeScriptException.mm:63)
3  NativeScript                   0x45a968 v8::internal::MessageHandler::ReportMessageNoExceptions(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::Object>, v8::Local<v8::Value>)
4  NativeScript                   0x45a7d4 v8::internal::MessageHandler::ReportMessage(v8::internal::Isolate*, v8::internal::MessageLocation const*, v8::internal::Handle<v8::internal::JSMessageObject>)
5  NativeScript                   0x39b53c v8::internal::Isolate::ReportPendingMessages()

This one seems to come from inside NativeScript, which contains native code, so I guess this is fine to read for you guys :)

Crashed: com.apple.main-thread
0  NativeScript                   0xb85e4 tns::FFICall::FFICall(tns::ParametrizedCall*) + 74 (FFICall.h:74)
1  NativeScript                   0xb3894 tns::Interop::CallFunctionInternal(tns::MethodCall&) + 1383 (Interop.mm:1383)
2  NativeScript                   0x1eaec tns::ArgConverter::Invoke(v8::Local<v8::Context>, objc_class*, v8::Local<v8::Object>, tns::V8Args&, tns::MethodMeta const*, bool) + 79 (ArgConverter.mm:79)
3  NativeScript                   0x71658 tns::MetadataBuilder::InvokeMethod(v8::Local<v8::Context>, tns::MethodMeta const*, v8::Local<v8::Object>, tns::V8Args&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool) + 820 (MetadataBuilder.mm:820)
4  NativeScript                   0x71120 tns::MetadataBuilder::PropertyGetterCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 677 (MetadataBuilder.mm:677)
5  NativeScript                   0x81df14 Builtins_CallApiCallback + 212
6  NativeScript                   0x9020bc Builtins_LdaNamedPropertyHandler + 3132
7  NativeScript                   0x81b818 Builtins_InterpreterEntryTrampoline + 248
8  NativeScript                   0x81b818 Builtins_InterpreterEntryTrampoline + 248
9  NativeScript                   0x81b818 Builtins_InterpreterEntryTrampoline + 248
Linguagem predominante
TypeScript
Estrelas
62
Forks
53
Merge médio
8d 4h
PRs com merge (30d)
2

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de NativeScript/firebase

Todas as issues de NativeScript/firebase

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.