Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems uploading files to objectstorage/bucket (PL/SQL)

Jan RunhartJul 13 2020 — edited Jul 14 2020

Dear forum(APEX)-users,

I'm having some difficulties with uploading to my bucket (Objectstorage). I'm following this (kind of) tutorial/blog by Adrian Png: https://blogs.oracle.com/oraclemagazine/better-file-storage-in-oracle-cloud. I can't get the upload function to work. I think the problem is in de PL/SQL code but i can,t seem to find it.

the PL/SQL code is exact as in the blog:

declare

  l_request_url varchar2(32767);

  l_content_length number;

  l_response clob;

  upload_failed_exception exception;

begin

  for file in (

    select * from apex_application_temp_files

    where name = :P2_FILE

  ) loop

    l_request_url := :G_BASE_URL || 'b/' || :P2_BUCKET_NAME

     || '/o/' || apex_util.url_encode(file.filename);

    apex_web_service.g_request_headers(1).name :=

      'Content-Type';

    apex_web_service.g_request_headers(1).value :=

      file.mime_type;

    l_response := apex_web_service.make_rest_request(

      p_url => l_request_url

      , p_http_method => 'PUT'

      , p_body_blob => file.blob_content

      , p_credential_static_id => :G_OCI_WEB_CREDENTIAL

    );

    if apex_web_service.g_status_code != 200 then

      raise upload_failed_exception;

    end if;

  end loop;

end;

I'm getting the HTTP response 502 - Bad Gateway respons.

Exception in "plsql process":

Error Stack: ORA-06510: PL/SQL: door gebruiker gedefinieerde uitzondering is niet verwerkt.

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 1594

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 2658

ORA-06512: in regel 25

ORA-06512: in regel 25

ORA-06512: in "SYS.DBMS_SYS_SQL", regel 2120

ORA-06512: in "SYS.WWV_DBMS_SQL_APEX_200100", regel 590

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 2621

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 1568

ORA-06512: in "APEX_200100.WWV_FLOW_EXEC_LOCAL", regel 2761

ORA-06512: in "APEX_200100.WWV_FLOW_EXEC", regel 3775

ORA-06512: in "APEX_200100.WWV_FLOW_EXEC", regel 3810

Backtrace: ORA-06512: in regel 25

ORA-06512: in regel 25

ORA-06512: in "SYS.DBMS_SYS_SQL", regel 2120

ORA-06512: in "SYS.WWV_DBMS_SQL_APEX_200100", regel 590

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 2621

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 1594

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 2658

ORA-06512: in regel 25

ORA-06512: in regel 25

ORA-06512: in "SYS.DBMS_SYS_SQL", regel 2120

ORA-06512: in "SYS.WWV_DBMS_SQL_APEX_200100", regel 590

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 2621

ORA-06512: in "APEX_200100.WWV_FLOW_DYNAMIC_EXEC", regel 1568

ORA-06512: in "APEX_200100.WWV_FLOW_EXEC_LOCAL", regel 2761

ORA-06512: in "APEX_200100.WWV_FLOW_EXEC", regel 3775

ORA-06512: in "APEX_200100.WWV_FLOW_EXEC", regel 3810

ORA-06512: in "APEX_200100.WWV_FLOW_PROCESS_NATIVE", regel 76

I can see the bucket, the file list. So all credentials and web source modules are working. Does anyone knows if the URL structure has changed or can someone help me into the good direction?

This post has been answered by jariola on Jul 14 2020
Jump to Answer
Comments
Post Details
Added on Jul 13 2020
4 comments
674 views