Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Webpack compatibility #16

Closed
derdrdirk opened this issue Jan 10, 2018 · 9 comments
Closed

Webpack compatibility #16

derdrdirk opened this issue Jan 10, 2018 · 9 comments
Assignees
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. web

Comments

@derdrdirk
Copy link

derdrdirk commented Jan 10, 2018

I am using Webpack to bundle my code for the later export to my server-less architecture. Unfortunately Google-Cloud does not seem to work with the Webpack workflow? Executing the from webpack produced bundle yields the error:

throw new Error("package.json does not exist at " + package_json_path);

Do to my research this is a problem with some Google Cloud dependencies:
googleapis/google-cloud-node#1821
grpc/grpc#11435

and the source probably is the node-pre-gyp module:
mapbox/node-pre-gyp#308

Environment details

  • OS: MacOS 10.13.2
  • Node.js version: v9.3.0
  • npm version: 5.6.0
  • dialogflow version: v2

Thanks!

@JustinBeckwith JustinBeckwith added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Sep 20, 2018
@JustinBeckwith
Copy link
Contributor

Greetings! Webpack isn't currently supported, but it's something we would very much like to do.

@pavelsavara
Copy link

This workaround helps serverless-heaven/serverless-webpack#342

@sibelius
Copy link

sibelius commented Nov 2, 2018

can we use this package on react-native?

right now we are using fetch directly like this https://github.com/innFactory/react-native-dialogflow/blob/master/js/Dialogflow_V2.js#L89

it'd be cool to have full support to react and react native

@selmertsx
Copy link

selmertsx commented Apr 19, 2019

I got the same issue to use @google-cloud/pubsub.
So I use the cloud Pubsub REST API directly.
Why don't you do this?

// example
import { google } from "googleapis";
import axios from "axios";
const url = "https://pubsub.googleapis.com/v1/projects/${project_name}/topics/${topic_name}:publish";

async function main() {
  const token = await google.auth.getAccessToken();
  const data = { messages: [ { data: new Buffer("hogehoge").toString("base64") }]}
  const config = {
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${token}`,
    },
  };
  return await axios.post(url, data, config);
}

main();

@ragu-swaminathan
Copy link

Is there any work around or fix available to use dialogflow in reactjs?

@bcoe
Copy link
Contributor

bcoe commented Jun 4, 2019

@ragu-swaminathan, we recently removed our dependency on grpc (which was a compiled dependency, and made running in reactjs a complete no-go); however, there's still some work to go before this library can easily be run in the browser.

This continues to be something we are working towards, but I don't believe there are any workarounds just yet.

@callmehiphop
Copy link
Contributor

@bcoe @JustinBeckwith is there a tracking issue we can ask users to subscribe to? Seems like this is applicable to all the nodejs clients.

@bcoe
Copy link
Contributor

bcoe commented Jun 7, 2019

@callmehiphop if one doesn't exist, let's create a tracking issue here:

https://github.com/googleapis/google-cloud-node

I agree it would be great to eventually provide a recipe for running in the browser.

@callmehiphop
Copy link
Contributor

googleapis/google-cloud-node#2933 has been opened!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. web
Projects
None yet
Development

No branches or pull requests

8 participants