You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

搭建OpenWhisk后无法找到并调用Web Action URL求助

Hey there! Let's work through getting your OpenWhisk Web Action URL sorted out so you can start calling it. Here's a step-by-step breakdown to fix this issue:

1. First, Finish Creating the Web Action Correctly

It looks like your wsk action create command was cut off—you need to add the flag that marks the action as a Web Action. Use either --web true (for JSON-formatted responses) or --web raw (for raw HTTP outputs like HTML/plain text). The full command should be:

wsk action create demo1/hello hello.js --web true -i

The -i flag matches what you used for package creation, which I assume is for targeting a local/self-hosted OpenWhisk instance or bypassing certificate checks.

2. Retrieve the Web Action URL

Once the action is properly created, run this command to fetch its dedicated URL:

wsk action get demo1/hello --url -i

You’ll get an output similar to this:

ok: got action demo1/hello
https://your-openwhisk-host/api/v1/web/your-namespace/demo1/hello.json

  • your-openwhisk-host: The address of your OpenWhisk instance (e.g., localhost:3233 for a local deployment)
  • your-namespace: Your OpenWhisk namespace (run wsk namespace list -i if you’re unsure—default is usually guest)
  • The .json suffix: Use this for JSON responses; if you used --web raw, replace it with .raw

3. Test the Web Action

Now you can call it via curl or directly in your browser:

  • Using curl (add -k if you’re using a self-signed certificate):
    curl -k https://your-openwhisk-host/api/v1/web/your-namespace/demo1/hello.json -i
    
  • Or paste the full URL into your browser (ignore certificate warnings for local instances if needed)

Quick Troubleshooting Checks

  • Confirm your OpenWhisk host port: Local deployments often use port 3233 for the API gateway (web actions require the gateway, not the direct controller port)
  • Verify the action’s web status: Run wsk action get demo1/hello -i and check the web-export field in the metadata—it should be set to true or raw
  • Ensure your namespace matches: The URL must use the exact namespace you’re working in

内容的提问来源于stack exchange,提问作者thach.nv92

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:09:15