invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.64k stars 2.21k forks source link

React Native - Getting error code "400: Cannot shorten a short Dynamic Link" whenever trying to shorten the dynamic link? #3382

Closed JayM96 closed 4 years ago

JayM96 commented 4 years ago

Issue :

when trying to generate a short link using firebase Dynamic links i'm getting following error.

Error: [dynamicLinks/build-failed] com.google.android.gms.common.api.ApiException: 400: Cannot shorten a short Dynamic Link:

React Native :

I have tried the following code for creating links :

const generatedDynamicLink = await firebase.dynamicLinks().buildLink({ link: https://test.page.link/groupinvite/name=test, domainUriPrefix: https://test.page.link/groupinvite, android: { packageName: 'com.test', }, ios: { bundleId: 'com.test', appStoreId: '1546898245', }, });

Above method works perfectly. But, it gives me a long link like, https://test.page.link//guestinvite?apn=com.test&ibi=com.test&isi=1498742044&link=https%3A%2F%2Ftest.page.link/%2Fguestinvite%2Fname%3Dtest

So to shorten the link i'm replacing firebase.dynamicLinks().buildLink(....) with "firebase.dynamicLinks().shortLink({.....},"SHORT")" But it gives me an error like,

Error: [dynamicLinks/build-failed] com.google.android.gms.common.api.ApiException: 400: Cannot shorten a short Dynamic Link:

So can anybody please suggest me a workaround solution to create a short link like "com.test/guestinvite/abdgsyd" ?

Also, how to easily fetch the initial link. currently i am using following link but i'm not able to get query parameter "name" from link.

componentDidMount() { dynamicLinks().getInitialLink().then((initialLink)=>{ console.log('initialLink : ', initialLink.url); }); }

package.json

"dependencies": { "@ptomasroos/react-native-multi-slider": "^1.0.0", "@react-native-community/async-storage": "1.7.1", "@react-native-community/geolocation": "^2.0.2", "@react-native-community/masked-view": "^0.1.6", "@react-native-community/netinfo": "^5.5.1", "@react-native-firebase/app": "^6.3.4", "@react-native-firebase/dynamic-links": "^6.3.4", "amplitude-js": "^5.9.0", "lodash": "^4.17.15", "react": "16.9.0", "react-native": "0.61.5", "react-native-add-calendar-event": "^3.0.1", "react-native-calendars": "1.259.0", "react-native-config": "^0.12.0", "react-native-confirmation-code-field": "^4.2.0", "react-native-device-info": "^5.4.1", "react-native-flash-message": "^0.1.15", "react-native-gesture-handler": "^1.5.3", "react-native-google-places-autocomplete": "^1.4.1", "react-native-inappbrowser-reborn": "^3.3.4", "react-native-intercom": "^14.0.0", "react-native-linear-gradient": "^2.5.6", "react-native-localize": "^1.3.2", "react-native-maps": "0.26.1", "react-native-modal": "^11.5.3", "react-native-notifications": "^3.1.2", "react-native-permissions": "^2.0.9", "react-native-read-more-text": "^1.1.2", "react-native-reanimated": "^1.4.0", "react-native-safe-area-context": "^0.6.2", "react-native-safe-area-view": "^0.14.6", "react-native-screens": "^2.0.0-alpha.23", "react-native-share": "^3.0.0", "react-native-snap-carousel": "^3.8.4", "react-native-splash-screen": "^3.2.0", "react-native-status-bar-height": "^2.4.0", "react-native-svg": "^12.0.3", "react-native-switch-pro": "^1.0.4", "react-navigation": "^4.0.10", "react-navigation-drawer": "^2.3.3", "react-navigation-stack": "^2.0.15", "react-navigation-tabs": "^2.7.0", "react-redux": "^7.1.3", "recompose": "^0.30.0", "redux": "^4.0.5", "redux-devtools-extension": "^2.13.8", "redux-form": "^8.2.6", "redux-persist": "^6.0.0", "redux-thunk": "^2.3.0", "styled-components": "^5.0.1" }, "devDependencies": { "@babel/core": "^7.6.2", "@babel/runtime": "^7.6.2", "@types/amplitude-js": "^5.8.0", "@types/jest": "^24.0.24", "@types/lodash": "^4.14.149", "@types/react-native": "^0.60.25", "@types/react-redux": "^7.1.5", "@types/react-test-renderer": "16.9.1", "@types/recompose": "^0.30.7", "@types/redux-form": "^8.2.0", "babel-jest": "^24.9.0", "babel-plugin-module-resolver": "^4.0.0", "jest": "^24.9.0", "metro-react-native-babel-preset": "^0.56.0", "react-native-svg-transformer": "^0.14.3", "react-test-renderer": "16.9.0", "typescript": "^3.7.3" }, "jest": { "preset": "react-native", "moduleFileExtensions": [ "ts", "tsx", "js", "jsx", "json", "node" ] }

Thanks.

Ehesp commented 4 years ago

Please follow the issue template.

JayM96 commented 4 years ago

@Ehesp changed the question template. I have added dependencies i am using via package.json

Ehesp commented 4 years ago

What version of the library are you using? You've missed loads out still.

JayM96 commented 4 years ago

@Ehesp i have uploded the package.json file to checkout the dependencies i am using.

stale[bot] commented 4 years ago

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 the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.

ChiragALogicalloop commented 1 year ago

I'm facing also same issue but I'm not found any solution. This solution is not working for me. Anyone please another solution suggests.