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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敟[馃悰] Permission errors after upgrading a function to v2 #7701

Open
2 of 10 tasks
pointersbad opened this issue Mar 24, 2024 · 2 comments
Open
2 of 10 tasks

馃敟[馃悰] Permission errors after upgrading a function to v2 #7701

pointersbad opened this issue Mar 24, 2024 · 2 comments
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report

Comments

@pointersbad
Copy link

Issue

After updating one of the cloud functions in the project to v2, I started getting permission errors accessing every function, not just the v2 one. Changing the functions to httpsCallableFromUri as described in #6622 helps the situation, but the change in the behavior of the v1 functions after deployment is strange. Besides, it is very inconvenient to change all the functions to callableFromUrl just for the sake of that one v2 function support, and I'm not even sure whether it's the same issue. Are you planning full support in the future? Should I use v1 for now and wait for the updates or just go with httpsCallableFromUrl from now on?

P.S. Thank you, contributors, for making this thing; much love!

Project Files

Javascript

Click To Expand

package.json:

    "@react-native-firebase/analytics": "19.0.0",
    "@react-native-firebase/app": "19.0.0",
    "@react-native-firebase/app-check": "19.0.0",
    "@react-native-firebase/auth": "19.0.0",
    "@react-native-firebase/firestore": "19.0.0",
    "@react-native-firebase/functions": "19.0.0",
    "@react-native-firebase/in-app-messaging": "19.0.0",
    "@react-native-firebase/installations": "^19.0.0",
    "@react-native-firebase/remote-config": "19.0.0",
    "@react-native-firebase/storage": "19.0.0"

firebase.json for react-native-firebase v6:

{
    "firestore": {
        "rules": "firebase/firestore.rules",
        "indexes": "firebase/firestore.indexes.json"
    },
    "functions": {
        "predeploy": [
            "npm --prefix \"$RESOURCE_DIR\" run lint",
            "npm --prefix \"$RESOURCE_DIR\" run build",
            "./functions/scripts/create-queue.sh"
        ],
        "source": "functions"
    },
    "emulators": {
        "auth": {
            "port": 9099
        },
        "functions": {
            "port": 5001
        },
        "firestore": {
            "port": 8080
        },
        "ui": {
            "enabled": true
        },
        "singleProjectMode": true
    }
}

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")

# https://www.npmjs.com/package/react-native-permissions#ios
# Resolve react_native_pods.rb with node to allow for hoisting
def node_require(script)
   # Resolve script with node to allow for hoisting
   require Pod::Executable.execute_command('node', ['-p',
     "require.resolve(
       '#{script}',
       {paths: [process.argv[1]]},
     )", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

install! 'cocoapods', :deterministic_uuids => false
plugin 'cocoapods-patch'

platform :ios, '13.0'
prepare_react_native_project!

setup_permissions([
  'LocationAlways',
  'LocationWhenInUse',
  'Notifications',
])

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled(['Dev.Debug', 'Prod.Debug'])

use_frameworks! :linkage => :static

target 'App' do
  project 'App',
    'Dev.Debug' => :debug,
    'Dev.Release' => :release,
    'Prod.Debug' => :debug,
    'Prod.Release' => :release
  use_expo_modules!
  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
      rescue => e
        Pod::UI.warn e
      end
    end
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  $RNFirebaseAsStaticFramework = true
  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    # :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  # Add additional packages...
  pod 'RNSegmentedPicker', :podspec => '../node_modules/react-native-segmented-picker/RNSegmentedPicker.podspec'
  pod 'customerio-reactnative/apn', :path => '../node_modules/customerio-reactnative'

  target 'AppTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

target 'NotificationServiceExtension' do
  pod 'customerio-reactnative-richpush/apn', :path => '../node_modules/customerio-reactnative'
end

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

System:
  OS: macOS 14.2
  CPU: (8) arm64 Apple M2
  Memory: 104.27 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.1
    path: ~/.nvm/versions/node/v18.19.1/bin/node
  Yarn: Not Found
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v18.19.1/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/me/.rbenv/shims/pod
SDKs:
  iOS SDK: Not Found
  Android SDK:
    API Levels:
      - "28"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 33.0.0
      - 34.0.0
    System Images:
      - android-31 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: /undefined
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.7.4
    path: /Users/me/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • 19.0.0
  • Firebase module(s) you're using that has the issue:
    • @react-native-firebase/functions
  • Are you using TypeScript?
    • Y & 4.9.5

@pointersbad pointersbad added Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report labels Mar 24, 2024
Copy link

Hello 馃憢, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot added the Type: Stale Issue has become stale - automatically added by Stale bot label Apr 21, 2024
@mikehardy
Copy link
Collaborator

Similar to what is mentioned on #6622 I do not believe there is anything we can do here at the react-native-firebase layer
I've implemented all the related APIs I'm aware of, and one of them results in a correctly setup auth on the function when called and one doesn't.

No one has investigated deeply enough to say why, but there is a method that works, my advice is simply to convert to that method as quickly as possible and move on, if v2 functions and their new capabilities are a requirement

@github-actions github-actions bot removed the Type: Stale Issue has become stale - automatically added by Stale bot label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report
Projects
None yet
Development

No branches or pull requests

2 participants