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

fix(rest-api-client): baseUrl is not used when location is undefined #855

Merged
merged 1 commit into from
Jun 7, 2021
Merged

fix(rest-api-client): baseUrl is not used when location is undefined #855

merged 1 commit into from
Jun 7, 2021

Conversation

potaracom
Copy link
Contributor

@potaracom potaracom commented May 1, 2021

Why

Occured error "location undefined" at React Native.
React Nativeでlocation undefinedエラーが発生します。

What

If baseUrl is passed, location is not used.
baseUrlが渡された場合はlocationを利用しない。

How to test

Execute REST API from browser, Node, React Native.
ブラウザやNode、React NativeからREST APIを実行します。

Checklist

  • Read CONTRIBUTING.md
  • Updated documentation if it is required.
  • Added tests if it is required.
  • Passed yarn lint and yarn test on the root directory.

@potaracom potaracom requested review from a team, zaki-yama and tasshi-me and removed request for a team May 1, 2021 06:46
@github-actions github-actions bot added the pkg: rest-api-client @kintone/rest-api-client label May 1, 2021
@zaki-yama
Copy link
Contributor

@potaracom
Thank you for sending the PR!
I confirmed the diff and understood what you wanted to solve in this PR.
But I'd like a little more information to understand more about the environment in which you encountered the problem, and reproduction steps.
(Because we haven't expected to use the rest-api-client with React Native)
So would you tell me:

  • How did you construct the build environment? (Are you using expo?)
  • Would it possible to share the example repository or a part of programs that can reproduce the error?
  • In which environment you encountered the problem? iOS simulator/Android simulator/iOS with Expo Go/etc.

For example, here's the situation in which I could reproduce the error. (But not sure this is the same as you encountered)

  • Install expo-cli and create a project
$ npm install --global expo-cli

$ expo init my-project
  • Install the latest @kintone/rest-api-client
$ npm install @kintone/rest-api-client
  • Modify app.tsx and import rest-api-client
 import React from 'react';
 import { StyleSheet, Text, View } from 'react-native';

+import { KintoneRestAPIClient } from "@kintone/rest-api-client";
+
 export default function App() {
+  const client = new KintoneRestAPIClient({
+    baseUrl: 'https://xxx.cybozu.com',
+  });
+
   return (
     <View style={styles.container}>
       <Text>Open up App.tsx to start working on your app!</Text>
  • Install expo go to my iPhone
  • Run expo start and open the app with my iPhone
  • -> The app shows "Can't find variable: location" error

@potaracom
Copy link
Contributor Author

potaracom commented Jun 5, 2021

I appreciate for your kindness.
実際に確認していただき、ありがとうございます。

How did you construct the build environment? (Are you using expo?)

I use Expo.
Expoを利用しています。

Would it possible to share the example repository or a part of programs that can reproduce the error?

Difficult because I don't have time.
However, it is the same procedure that you have prepared.
Thank you for actually confirmation.
時間がないので難しいのですが、記載いただいた内容と同じ手順で利用しています。
(実際に確認していただき本当にありがとうございます)

In which environment you encountered the problem? iOS simulator/Android simulator/iOS with Expo Go/etc.

iOS and Android with Expo Go.
iOSとAndroidのExpo Goで発生しています。

@zaki-yama zaki-yama changed the title support undefined location env fix(rest-api-client): baseUrl is not used when location is undefined Jun 7, 2021
@zaki-yama zaki-yama merged commit b892520 into kintone:master Jun 7, 2021
@zaki-yama
Copy link
Contributor

zaki-yama commented Jun 7, 2021

@potaracom
Thank you for your reply!
I merged your PR.

FYI, I found that it still raises an error when calling the constructor without baseUrl.
It's an expected behavior, but it would be nice if we can see more helpful error message.
So I reported it as #934 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: rest-api-client @kintone/rest-api-client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants