bugsnag / bugsnag-dsym-upload

Scripts and Fastlane tasks for uploading dSYM files to BugSnag
https://docs.bugsnag.com/build-integrations/fastlane/
MIT License
36 stars 13 forks source link

Bugsnag on Fastlane - Couldn't find action for the given filter #69

Closed kangzeroo closed 2 years ago

kangzeroo commented 3 years ago

I think there is an installation issue with Bugsnag's action on Fastlane Android. I am unable to even get it to appear in fastlane actions after installation. Perhaps im missing something? This is an extremely simple example.

Describe the bug

Cannot use bugsnag actions on fastlane. $ fastlane action send_build_to_bugsnag says the action was not found.

image

Verified that the Gemfile and fastlane repo are on same depth.

image

Steps to reproduce

Inside a react-native android project with fastlane: $ fastlane add_plugin bugsnag $ tail Fastfile

# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!

gem 'fastlane-plugin-bugsnag'

$ fastlane action send_build_to_bugsnag

Couldn't find action for the given filter.

Environment

platform :android do desc "Build a release version & deploy to internal test track" lane :beta do gradle(task: "bundle", build_type: "Release") upload_to_play_store(track: "internal", skip_upload_apk: true) send_build_to_bugsnag( config_file: "./app/src/debug/AndroidManifest.xml" ) end

desc "Build a release version & deploy to production on Google Play" lane :relase do gradle(task: "bundle", build_type: "Release") upload_to_play_store(skip_upload_apk: true) send_build_to_bugsnag( config_file: "./app/src/main/AndroidManifest.xml" ) end end


<!--
  Below are a few approaches you might take to communicate the issue, in
  descending order of awesomeness. Please choose one and feel free to delete
  the others from this template.
-->

### Example Repo <!-- Option 1 -->

- [ ] Create a minimal repository that can reproduce the issue
- [ ] Link to it here:

<!-- Error messages, if any -->
<details><summary>Error messages:</summary>

Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile [13:02:10]: It seems like you wanted to load some plugins, however they couldn't be loaded [13:02:10]: Please follow the troubleshooting guide: https://docs.fastlane.tools/plugins/plugins-troubleshooting/ Loading documentation for send_build_to_bugsnag:

Couldn't find action for the given filter.


</details>
johnkiely1 commented 3 years ago

Hi @kangzeroo Did you get an option similar to this when running fastlane add_plugin bugsnag

Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile

10:27:36: It looks like fastlane plugins are not yet set up for this project. 10:27:36: fastlane will modify your existing Gemfile at path "path" 10:27:36: This change is necessary for fastlane plugins to work 10:27:36: Should fastlane modify the Gemfile at path "path" for you? (y/n)

You would need to select y to this otherwise you would encounter a problem like you are describing.

Can you try rerunning fastlane add_plugin bugsnag ensuring that y is selected. Let me know how you get on with this.

kangzeroo commented 3 years ago

@johnkiely1 I didnt see that message on running fastlane add_plugin bugsnag as it was already installed. I removed the plugin and reinstalled from scratch, and this time saw the option, opted yes, and then tested bundle exec fastlane action send_build_to_bugsnag. It worked!

My Gemfile looks like this:

# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!

source "https://rubygems.org"

gem 'fastlane'

plugins_path = File.join(File.dirname(__FILE__), '.', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

Previously it was located at android/Gemfile but now its at android/fastlane/Gemfile. That doesn't seem right? Should I be moving it back to android/Gemfile and then modifying the auto-generated Gemfile to plugins_path = File.join(File.dirname(__FILE__), './fastlane', 'Pluginfile')? Or keeping it at android/fastlane/Gemfile?

kangzeroo commented 2 years ago

@johnkiely1 it seems like no matter what config I use, send_build_to_bugsnag takes 0 seconds and doesnt upload anything (for Android via fastlane).

-bash

Inside my build.gradle:

bugsnag {
    retryCount = 5
    uploadReactNativeMappings = true // enables upload of React Native source maps
    overwrite = true
    variantFilter { variant ->
        enabled = true
    }
}

Any idea whats happening?

xljones commented 2 years ago

Hey @kangzeroo, I would expect your Gemfile to be at the root of your project, and to contain the Gem fastlane. Your Pluginfile should be found under fastlane/Pluginfile, and will contain the Gem fastlane-plugin-bugsnag.

Previously it was located at android/Gemfile but now its at android/fastlane/Gemfile. That doesn't seem right? Should I be moving it back to android/Gemfile and then modifying the auto-generated Gemfile to plugins_path = File.join(File.dirname(FILE), './fastlane', 'Pluginfile')? Or keeping it at android/fastlane/Gemfile?

I agree, that does look odd. I've not been able to replicate it, but you may want to manually move the Gemfile back to the project root.

For a basic install, the Gemfile will look like:

source "https://rubygems.org"

gem "fastlane"

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

And the fastlane/Pluginfile will look like:

# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!

gem "fastlane-plugin-bugsnag"

send_build_to_bugsnag takes 0 seconds and doesnt upload anything (for Android via fastlane).

I would not expect this action to take very long as it's simply posting the build report to the Bugsnag Build API, please note that this lane does not upload anything. Source maps and ProGuard files for Android are uploaded through the Bugsnag Android Gradle plugin.

Are you seeing the build reported as expected? You can find this under the Releases tab of your project.

kangzeroo commented 2 years ago

The bugsnag gradle plugin doesnt seem to be doing anything on my build, but I realized my mistake and will share it here in case anyone else encounters it!

Below is my build.gradle file located in android/app/build.gradle

bugsnag {
    uploadReactNativeMappings = true // enables upload of React Native source maps
    variantFilter { variant ->
        enabled = true
    }
}

That is wrong, it should instead be located in android/build.gradle. This is probably obvious for experienced mobile developers, but not so obvious for web developers coming to react-native. I hope that helps someone googling!

Thanks @xander-jones for your help!