AdobeDocs / photoshop-api-docs

Adobe Photoshop API
https://adobedocs.github.io/photoshop-api-docs/
MIT License
104 stars 20 forks source link

Replace smartobject content not working #68

Closed kratosvn closed 3 years ago

kratosvn commented 3 years ago

Expected Behaviour

Replace content in smartobject after that i can see the resault on image uploaded to s3 presign url

Actual Behaviour

Cant see the result on presign url

Reproduce Scenario (including but not limited to)

Steps to Reproduce

step1: request replace content: curl --location --request POST 'https://image.adobe.io/pie/psdService/smartObject' \ --header 'Authorization: Bearer <REDACTED>' \ --header 'x-api-key: <REDACTED>' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": [ { "href": "https://assets.boostflow.com/phub/16000522145f5edbf62342e.psd", "storage": "external" } ], "options": { "layers": [ { "name": "print", "input": { "href": "https://img.boostflowcdn.com/phub/0x280@15650901095d49613d4d140.png", "storage": "external" } } ] }, "outputs": [ { "storage": "external", "href": "https://s3.amazonaws.com/assets-dev.boostflow.com/phub/adobe/1615225486437418dbe9.psd?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUAOPEXUFUULWPPYA%2F20210308%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210308T174446Z&X-Amz-Expires=2160000&X-Amz-SignedHeaders=content-encoding%3Bcontent-type%3Bhost%3Bx-amz-acl&X-Amz-Signature=bf22590591feb5632a596b6e4243c5b3ce016a148012a05372e2a465ce6eda90", "type": "vnd.adobe.photoshop" } ] }'

step2: check status: https://image.adobe.io/pie/psdService/status/9fcd6642-50e1-4eaf-aa32-6871eb5cbcc1

step3: check result: { "jobId": "9fcd6642-50e1-4eaf-aa32-6871eb5cbcc1", "outputs": [ { "input": "https://assets.boostflow.com/phub/16000522145f5edbf62342e.psd", "status": "succeeded", "created": "2021-03-08T17:45:01.888Z", "modified": "2021-03-08T17:45:04.098Z", "_links": { "renditions": [ { "href": "https://s3.amazonaws.com/assets-dev.boostflow.com/phub/adobe/1615225486437418dbe9.psd?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUAOPEXUFUULWPPYA%2F20210308%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210308T174446Z&X-Amz-Expires=2160000&X-Amz-SignedHeaders=content-encoding%3Bcontent-type%3Bhost%3Bx-amz-acl&X-Amz-Signature=bf22590591feb5632a596b6e4243c5b3ce016a148012a05372e2a465ce6eda90", "storage": "external", "type": "vnd.adobe.photoshop" } ] } } ], "_links": { "self": { "href": "https://image.adobe.io/pie/psdService/status/9fcd6642-50e1-4eaf-aa32-6871eb5cbcc1" } } } step 4: access to presign url: https://s3.amazonaws.com/assets-dev.boostflow.com/phub/adobe/1615225486437418dbe9.psd?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUAOPEXUFUULWPPYA%2F20210308%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210308T174446Z&X-Amz-Expires=2160000&X-Amz-SignedHeaders=content-encoding%3Bcontent-type%3Bhost%3Bx-amz-acl&X-Amz-Signature=bf22590591feb5632a596b6e4243c5b3ce016a148012a05372e2a465ce6eda90

but nothing uploaded to this url.

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

johnleetran commented 3 years ago

Could you check the AWS bucket and see if the file exists? On AWS, you must generate separate GET and PUT signed urls. Meaning PUT urls do not have GET access when used.

kratosvn commented 3 years ago

hi @johnleetran I checked AWS bucket but the file not existed. I use test my presign url to put image from client, it work fine.

johnleetran commented 3 years ago

are you still having issues or was this intermittent? for reference, below is nodejs code to generate presigned url from aws that i know works

Presigned Get URL

var AWS = require('aws-sdk')
var bucket = '<MY_BUCKET_NAME>'
var object_key = '<PATH/TO/SOME/IMAGE.psd>'
var operation =  'getObject'
var region = '<AWS_REGION>' 
AWS.config.update({"region": region});
let params = {Bucket: bucket, Key: object_key, Expires: 3600 * 24};
let s3 = new AWS.S3({apiVersion: '2006-03-01', signatureVersion: 'v4'});
s3.getSignedUrl(operation, params, function (err, url) {
    if(err){
        console.log(err)
    }else{
        console.log(url)
    }
});

Presigned PUT url

var AWS = require('aws-sdk')
var bucket = '<MY_BUCKET_NAME>'
var object_key = '<PATH/WHERE/YOU/WANT/OUTPUT.psd>'
var operation =  'putObject'
var region = '<AWS_REGION>' 
AWS.config.update({"region": region});
let params = {Bucket: bucket, Key: object_key, Expires: 3600 * 24};
let s3 = new AWS.S3({apiVersion: '2006-03-01', signatureVersion: 'v4'});
s3.getSignedUrl(operation, params, function (err, url) {
    if(err){
        console.log(err)
    }else{
        console.log(url)
    }
});
kratosvn commented 3 years ago

Hi @johnleetran I'm trying to use dropbox temporary_upload_link. But when i check the job it return "Unable to upload the outputs". Detail: job link: https://image.adobe.io/pie/psdService/status/764e3b79-592b-4683-8d7f-d94013e99d00 response:

    "jobId": "764e3b79-592b-4683-8d7f-d94013e99d00",
    "outputs": [
        {
            "input": "https://assets.boostflow.com/phub/-------------.psd",
            "status": "failed",
            "created": "2021-08-24T16:03:38.322Z",
            "modified": "2021-08-24T16:03:43.431Z",
            "errors": {
                "code": 400,
                "details": [
                    {
                        "name": "https://content.dropboxapi.com/apitul/1/-----------",
                        "reason": "Unable to upload the outputs"
                    }
                ],
                "title": "Bad Request",
                "type": "InputValidationError"
            }
        }
    ],
    "_links": {
        "self": {
            "href": "https://image.adobe.io/pie/psdService/status/764e3b79-592b-4683-8d7f-d94013e99d00"
        }
    }
}

url from dropbox to upload output: image

I upload to my dropbox link its work image

can you help me check what is wrong for my request? thank you