Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: app-logs poll returns HTTP 400 "Malformed JWT" — `shopify app dev` loops "Error while polling app logs" (CLI 4.9.4)

未关闭
#8,906 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

Start in the app-logs poller's error handler (onUnknownError), which drops the status and body before printing "Error while polling app logs.", and in the request builder that sets the authorization and X-Shopify-Access-Token headers for app_logs/poll. A reasonable first step is to surface the HTTP status and response body in that error output and check it with a test or a mocked 400 response. The root cause lies server-side and is under investigation by Shopify, so the work is not to fix the JWT.

由索引模型根据 Issue 内容生成。

描述

Summary

With an app that has a Function extension, shopify app dev starts the app-logs poller (as designed), but every poll fails and the app-logs panel loops forever:

app-logs │ Error while polling app logs.
app-logs │ Retrying in 5 seconds.

The underlying request returns HTTP 400 {"errors":["Malformed JWT"]}. The CLI never shows the status or body, so the failure is undiagnosable without patching the CLI.

Expected behavior

shopify app dev streams Function run logs to the terminal under the app-logs prefix.

Actual behavior

Every app_logs/poll request fails from the first request to the end of the session, repeating every 5 seconds. shopify app logs -s <dev-store> reproduces the identical failure standalone, so it is not specific to app dev.

Note: only apps that contain a Function extension poll app logs at all (allExtensions.some(isFunctionExtension) gates the poller), so apps without a Function extension are unaffected and will not show this.

Reproduction
  1. Use an app that contains a Function extension (e.g. any type = "function" extension in shopify.extension.toml).
  2. Link a development store.
  3. Run shopify app dev (or shopify app logs -s <dev-store>).
  4. Observe the loop.
Evidence (captured on CLI 4.9.4)

AppLogsSubscribe (App Management API) succeeds and returns a jwtToken. The subsequent poll is then rejected:

  • Request: GET https://app.shopify.com/app_management/unstable/organizations/<org-id>/app_logs/poll
    • headers sent (per the CLI's own builder): authorization: Bearer <jwt> and X-Shopify-Access-Token: Bearer <jwt>
  • Response: HTTP 400
  • Body: {"errors":["Malformed JWT"]}

The JWT is fresh (30 minutes from expires_at) and its payload carries no organization claim:

{"shop_ids":[<id>],"app_id":<id>,"api_key":"<redacted>","user_id":"<redacted>","expires_at":<future>}

The poll endpoint is organization-scoped, and the token contains no organization claim. That mismatch is one hypothesis; it is also consistent with a signing/secret mismatch on the server side. Either way the minted subscription token is not accepted by the poll endpoint for any shop or organization.

CLI defect (separate, makes this hard to diagnose)

The poller's error handler drops the status code and response body before printing Error while polling app logs. (onUnknownError). --verbose shows the request but not the response, so the 400 + Malformed JWT only surfaces if the CLI is patched.

Environment
  • Shopify CLI 4.9.4 (Homebrew), macOS (arm64)
  • Node 26.11.1
  • App has exactly one function extension
  • organizationId resolves correctly for this app (appByKey returns it), so this is not a missing-organization problem
Notes
主要语言
TypeScript
星标
757
派生
294
平均合并
2 天 20 小时
30 天内合并 PR
163

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Shopify/cli 的其他 Issue

查看 Shopify/cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。