question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT

See original GitHub issue

Hi, I have this error in the assistant console

API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: "(response_metadata.status.details[0]): invalid value Missing @type for any field in google.actions.v2.AppResponse for type Any".

But I have setup the API Version 2 to off in the Dialogflow settings, since this node.js client does not currently supports the Dialogflow v2 api. How to force the v2 then?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Canaincommented, Apr 12, 2018

@Anshini-Singh since you are using the v1 client library, and firebase functions 1.0.0, you need to change these parts of your code:

Instead of

const DialogflowApp = require('actions-on-google');

It should be

const { DialogflowApp } = require('actions-on-google');

Your original code should throw an error when called since the wildcard import of actions-on-google is not a class and is not instantiable. Check your firebase console function logs for errors.

For Firebase Functions 1.0.0, you need to remove this part:

admin.initializeApp(functions.config().firebase);
1reaction
Anshini-Singhcommented, Apr 12, 2018

I am also facing the same issue. Here is the my code snippet. Please let me know if any other information required.

'use strict';

process.env.DEBUG = 'actions-on-google:*';
const DialogflowApp = require('actions-on-google');
const admin = require('firebase-admin');
const functions = require('firebase-functions');

admin.initializeApp(functions.config().firebase);

// a. the action name from the created-intent Dialogflow intent
const Actions = {
  NAME_ACTION : 'created-intent'
};
// b. the parameters that are parsed from the created-intent intent
const Parameters = {
  NUMBER_ARGUMENT : 'number'
};

exports.dialogflowWithFireBase = functions.https.onRequest((request, response) => {
  const app = new DialogflowApp({request, response});
  console.log('Request headers: ' + JSON.stringify(request.headers));
  console.log('Request body: ' + JSON.stringify(request.body));

// c. The function that generates the response
  function replyIntent (app) {
  //  let number = app.getArgument(NUMBER_ARGUMENT);
    app.tell('Hello there your are in firebase functions');
  }

// d. build an action map, which maps intent names to functions
  let actionMap = new Map();
  actionMap.set(Actions.NAME_ACTION, replyIntent);
app.handleRequest(actionMap);
});

and these are the dependencies in my package.json

{
    "actions-on-google": "1.10.0",
    "firebase-admin": "~5.11.0",
    "firebase-functions": "^1.0.0"
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

API Version 2: Failed to parse JSON response string with ...
I had this issue because I had not given any action name. Giving the action name resolved this for me.
Read more >
Error while parsing JSON Response in REST API Post call
I switched to returning a JSON String and then Deserialize the JSON String, it still raises an error "Failed to parse response of...
Read more >
Carousel Images Invalid Argument · Issue #212 · actions-on-google ...
API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: "(carousel_select.items[1].image): invalid value ...
Read more >
HTTP status and error codes for JSON | Cloud Storage
The following document provides reference information about the status codes and error messages that are used in the Cloud Storage JSON API.
Read more >
Error Responses - Amazon Simple Storage Service
Error Code Description HTTP Status Code AccessControlListNotSupported The bucket does not allow ACLs. 400 Bad Request AccessDenied Access Denied 403 Forbidden BucketAlreadyOwnedByYou 409 Conflict (in all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found