Unable to upload a file - 403 Error

I am trying to upload a file (PDF and text), using the Attachment field but I get the following 403 (Forbidden) error:

https://{SUBDOMAIN}.kintone.com/k/api/blob/upload.json?ref=...... 403 (Forbidden)
Uncaught SyntaxError: Unexpected token '<', "<!--# Id: "... is not valid JSON

Could this be a proxy or internal network problem?

Thanks.

Hello @H_Nar

Based on the error message, there could be several potential causes. Assuming you're using a script similar to the one provided on the following page, here are some possible reasons:

  1. Incorrect URL or Subdomain: Double-check that the URL is correctly replaced with the actual subdomain of your Kintone instance.
  2. Missing or Invalid Request Token: Ensure that kintone.getRequestToken() returns a valid token.
  3. Permissions and API Token: Verify that your API token or the user associated with it has the necessary permissions to upload files.
  4. CORS and Headers: Make sure that the X-Requested-With header is correctly set to comply with CORS policies.
  5. Blob and FormData: Confirm that the Blob and FormData objects are correctly created and formatted.

thanks @Chris

but it's native attachment field.
attachment

this is error detail.
error

Thanks.

Hello @H_Nar ,

I'm not entirely clear on your question, but if you're referring to uploading a file to Kintone using "https://{subdomain}.kintone.com/k/v1/file.json," please note that this action does not upload the file to an Attachment field of an App.
To upload the file to an Attachment field, you will need to use the fileKey with the Add Record or Update Record API as noted on the help page.

Hello @Chris,

Thanks for your reply.

I did not use JavaScript code when uploading the file.

I just set the basic attachment field, then browsed for the file and saved the record. That's it.

Could it be a communication issue between the customer network and the Kintone servers?

Best regards,
HR

Hello @H_Nar ,

Does your Kintone App have a plugin or Javascript customization?

Potentially, there is a conflict with the plugin or customization.

Also, what file are you trying to attach to the record?

Note, the maximum file size limit for a single attachment is 1 GB.

For more information, refer to the following help articles:

Hi @Chris

Uploading works fine in my environment.
However, the upload is not working in the customer environment.

Then I created a test app and added only one attachment field.
There are no other plugins or JavaScript customizations.
The file is pdf or txt.

Hello @H_Nar ,

I see; thank you for the additional information.

My next guess as to the cause of this strange Attachment field error is a permission conflict.

In the customer's Kintone App, look at the Permissions for Fields settings.
App's settings > App Settings tab > Permissions section > Fields option.

Then, see if the attachment field is set as the Target Field in the table.

The customer or your account may not have permission to view or edit the field.

For more information, refer to the Configuring Permissions for Fields help article.

1 Like

HI @Genji

This app does not have permission.
Could this error occur if my corporate network is blocking communication with AWS servers?

Hi there! Can I ask a number of questions:

  • Does this happen on only 1 App, or does it happen on other Apps within the customer's account?
  • Does this happen for different type of files?
  • Does this happen only when you make a new record, upload and then save? Or does it also happen when you edit an existing record, upload and then save?

Hello @H_Nar ,

If this problem is not solved, yet, please try contacting customer support since this might be a proxy problem.

1 Like

Hello, everyone

thanks, I'll contact cusomer support.

2 Likes