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 not recognized price in items #5347

Closed
3 of 10 tasks
rukmanary opened this issue May 21, 2021 · 5 comments
Closed
3 of 10 tasks

[🐛] Firebase not recognized price in items #5347

rukmanary opened this issue May 21, 2021 · 5 comments
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report

Comments

@rukmanary
Copy link

rukmanary commented May 21, 2021

Issue

I already read this #5227 and see this #5232 so I upgraded my analytics to version 11.4.1. But, every time I send price, it gets an error:

Error: firebase.analytics().logAddToCart(*): unknown property 'items'.

I tested with this simple code:

firebase.analytics().logAddToCart(
{
        items: [
          {
            price: 2000,
          },
        ],
}
)

I checked struct.js, index.d.ts, and everything else, I confirm that price is defined. I also do rm -rf node modules, reinstall it, reset-cache, and clean gradle... But I still get this error. Why?


Project Files

Javascript

Click To Expand

package.json:

 "react": "16.9.0",
 "react-native": "0.61.1",
 "@react-native-firebase/analytics": "^11.4.1",
 "@react-native-firebase/app": "^11.4.1",
 "@react-native-firebase/messaging": "^11.4.1",

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

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:

 OUTPUT GOES HERE
  • 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:
    • firebase v6
  • Firebase module(s) you're using that has the issue:
    • analytics
  • Are you using TypeScript?
    • N


@rukmanary rukmanary added help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report labels May 21, 2021
@rukmanary rukmanary changed the title [🐛] Firebase not recognized Price in items [🐛] Firebase not recognized price in items May 21, 2021
@mikehardy
Copy link
Collaborator

We're on v12 now or at least v12.5
You skipped all the other parts of the template which results in immediate close, apologies.

Others had success with quirks here #4578

This must be something project specific, sorry

@rukmanary
Copy link
Author

Sorry, but I don't understand... The price item is already defined here in node_modules/@react-native-firebase/analytics/lib/structs.js also in here node_modules/@react-native-firebase/analytics/lib/index.d.ts
Screen Shot 2021-05-22 at 06 51 52

but somehow I get this error:
Screen Shot 2021-05-22 at 06 56 27

I'm running the app with breakpoints now to debug it. I put breakpoints at node_modules/@react-native-firebase/app/lib/common/struct.js on validateStruct function. And in the try block return struct(value); this is what I got:
Screen Shot 2021-05-22 at 07 37 24

why there is no price in it? As I mention in the first screenshot, the price is right there.

Then I tried to run again from the start (refresh app) and debug it at struct function in node_modules/superstruct/lib/index.js and I got this:
Screen Shot 2021-05-22 at 08 03 53

At least can you help me explain why there's no price key in here? As you mention in #5232 (comment) this fix is already in version 11.4.1. I confirm that price is defined at index.d.ts and node_modules/@react-native-firebase/analytics/lib/structs.js as I show in the screenshot above but why I didn't get the price key in schema? Please help 🙏

@mikehardy
Copy link
Collaborator

I can only assume the code executing is somehow not the code you are inspecting. That's intentionally vague because I don't know how that could happen but it's a hypothesis that fits the data.
npx react-native-clean-project perhaps.

@rukmanary
Copy link
Author

Yes, It was cached in my machine. I start new project and it works well. Then I run this project again and everything is fine. I am sorry for creating this issue and thank you so much

@mikehardy
Copy link
Collaborator

If I had a dollar for every time I've had the same thing happen ;-). It's how I knew to suggest it, and I've personally contributed to react-native-clean-project because now it saves me every time, spread the news and help your fellow devlopers. Good luck with your project!

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. type: bug New bug report
Projects
None yet
Development

No branches or pull requests

2 participants