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

集成Photoshop API到Web应用时遇500内部服务器错误求助

问题:Photoshop API集成Express应用时遇到500内部服务器错误

我正尝试将Photoshop API集成到Web应用中,目前处于基础阶段,搭建了一个Express应用,包含简单的/upload端点,流程如下:

  • 从Dropbox获取图片链接和Photoshop Action,使用Dropbox SDK
  • 从Dropbox获取上传链接
  • 调用Adobe Photoshop API执行Action

核心代码

app.post('/upload', upload.any() , async (req, res, next) => {
    // console.log(req.files);
    try {
        const file = req.files[0];
        const fileData = await getFileLink('/scott.jpg');
        const fileLink = fileData.result.link;
        const actionData = await getFileLink('/Black-White-Sample.atn');
        const actionLink = actionData.result.link;
        const uploadLink = await getUploadLink();

        const response = await fetch('https://image.adobe.io/pie/psdService/text', {
            method: 'POST',
            headers: {
                Authorization: `Bearer ${ADOBE_ACCESS_TOKEN}`,
                "x-api-key": ADOBE_CLIENT_ID,
                "Content-Type": "application/json"
            },
            body: {
                inputs: [
                            {
                                storage: "dropbox",
                                href: fileLink
                            }
                        ],
                options: {
                    actions: [
                        {
                            storage: "dropbox",
                            href: uploadLink
                        }
                    ]
                },
                outputs: [
                    {
                        storage: "dropbox",
                        type: 'image/png',
                        href: `${uploadLink}`
                    }
                ]
                }
        });    
        res.send('success');
    } catch(err) {
        console.log('ERROR XOXOXOXO' + err);
    }
}, (err) => {
    console.log(err);
})

错误响应

调用API后返回500内部服务器错误,请求未抛出异常但返回了success消息,响应结构如下:

RESPONSE ===================
Body {
  url: 'https://image.adobe.io/pie/psdService/photoshopActions',       
  status: 500,
  statusText: 'Internal Server Error',
  headers: Headers {
    _headers: {
      server: [Array],
      date: [Array],
      'content-type': [Array],
      'content-length': [Array],
      connection: [Array],
      'access-control-allow-credentials': [Array],
      'access-control-allow-headers': [Array],
      'access-control-allow-methods': [Array],
      'access-control-allow-origin': [Array],
      exposeheaders: [Array],
      'strict-transport-security': [Array],
      'x-request-id': [Array]
    }
  },
  ok: false,
  body: PassThrough {
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: [Object], tail: [Object], length: 1 },
      length: 236,
      pipes: [],
      flowing: null,
      ended: true,
      endEmitted: false,
      reading: false,
      constructed: true,
      sync: false,
      needReadable: false,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      destroyed: false,
      errored: null,
      closed: false,
      closeEmitted: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: false,
      dataEmitted: false,
      decoder: null,
      encoding: null,
      [Symbol(kPaused)]: null
    },
    _events: [Object: null prototype] { prefinish: [Function: prefinish] },
    _eventsCount: 1,
    _maxListeners: undefined,
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: true,
      needDrain: false,
      ending: true,
      ended: true,
      finished: true,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: false,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      constructed: true,
      prefinished: true,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false,
      closeEmitted: false,
      [Symbol(kOnFinished)]: []
    },
    allowHalfOpen: true,
    [Symbol(kCapture)]: false,
    [Symbol(kCallback)]: null
  },
  bodyUsed: false,
  size: 0,
  timeout: 0,
  _raw: [],
  _abort: false
}

Dropbox相关函数

async function getFileLink(path) {
    try {
        const fileLink = await dbx.filesGetTemporaryLink({path: path});
        // console.log(fileLink);
        return fileLink;
    } catch(err) {
        console.log(err);
    }

}
async function getUploadLink() {
    try {
        const res = await dbx.filesGetTemporaryUploadLink({
            commit_info: {
                autorename: true,
                mode: 'add',
                mute: false,
                path: '/New Folder',
                strict_conflict: false
            }
        })
        return res.result.link
    } catch(err) {
        console.log(err);
    }
}

我不清楚问题所在,已排除API试用版的问题,也排查了所有能想到的点,希望有经验的人提供帮助。

内容的提问来源于stack exchange,提问作者Zepticona

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.22 13:15:09