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

[BUG] Error occurs when executing updateLIFFApp in LiffClient #998

Open
odanado opened this issue Oct 10, 2024 · 0 comments
Open

[BUG] Error occurs when executing updateLIFFApp in LiffClient #998

odanado opened this issue Oct 10, 2024 · 0 comments
Labels

Comments

@odanado
Copy link
Member

odanado commented Oct 10, 2024

Bug Report

Describe the bug
I found that an error occurs when I execute updateLIFFApp in LiffClient.

To Reproduce

Steps to reproduce the behavior:

  1. Run this code
import * as line from "@line/bot-sdk";

const liffClient = new line.liff.LiffClient({
  channelAccessToken: process.env.LINE_TOKEN,
});

const res = await liffClient.updateLIFFApp("2006142821-LN7nErlM", {
  view: {
    url: "https://new2.example.com",
  },
});
consola.log("res", res);
  1. Get an error
$ node run.js
undefined:1


SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at parseJSONFromBytes (node:internal/deps/undici/undici:5472:19)
    at successSteps (node:internal/deps/undici/undici:5454:27)
    at fullyReadBody (node:internal/deps/undici/undici:4381:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async consumeBody (node:internal/deps/undici/undici:5463:7)
    at async LiffClient.updateLIFFAppWithHttpInfo (file:///path/to/repo/node_modules/@line/bot-sdk/dist/liff/api/liffClient.js:124:43)
    at async LiffClient.updateLIFFApp (file:///path/to/repo/node_modules/@line/bot-sdk/dist/liff/api/liffClient.js:109:17)
    at async file:///path/to/repo/run.js:7:13

Node.js v22.6.0

Expected behavior

No errors should occur.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: macOS 14.5
  • Node.js Version 22.6.0
  • line-bot-sdk-nodejs version(s) 9.4.0

Additional context

An error occurred in the function call, but the URL was updated, so the API execution was successful.

I have also confirmed that the following shell script runs successfully.

set -uex

curl -vvv -X PUT https://api.line.me/liff/v1/apps/2006142821-LN7nErlM \
-H "Authorization: Bearer ${LINE_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
    "view": {
        "url": "https://new.example.com"
    }
}'

It is likely that the error is occurring because the response body from the API is an empty string, which cannot be converted to JSON.
ref:

return { httpResponse: res, body: await res.json() };

@odanado odanado added the bug label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant