Hello,

I believe that the question-answer format from StackOverflow 
<https://stackoverflow.com> may be more suited in this case and it will 
give your issue more visibility, which will result in having a bigger 
chance of managing to solve it.


Best regards,

Àlex J.

On Thursday, February 4, 2021 at 9:01:32 AM UTC+1 rich.p...@gmail.com wrote:

> Hello all,
>
> I've been struggling with this one for a little while now I've tried a few 
> different options but none seem to work. I have this code which takes and 
> image and then uploads it to a bucket which like I say works fine on my 
> machine but when I deploy it, it doesn't work.
>
> Storage storage = 
> StorageOptions.newBuilder().setProjectId(projectId).build().getService(); 
> private Bucket bucket = storage.get(bucketName); if(bucket == null) { 
> bucket = storage.create(BucketInfo.of(bucketName)); } 
> System.out.println("storage: "+storage); BlobInfo blobInfo = 
> storage.create( BlobInfo .newBuilder(bucketName, fileName) .setAcl(new 
> ArrayList<>(Arrays.asList(Acl.of(com.google.cloud.storage.Acl.User.ofAllUsers(),
>  
> com.google.cloud.storage.Acl.Role.READER)))) .setContentType("image/jpeg") 
> .build(), fileStream.getBytes()); //Don't get this print line :/ 
> System.out.println("File: "+fileStream.getBytes()); String fileUrl = 
> blobInfo.getMediaLink();
>
> It appears as if I can't get access to the Storage for my instance. I have 
> all the latest versions of gcloud and google-app-engine.
>
> I am running it inside a Spring Boot application on Java 8 with Maven 
>
> Here is my Pom.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance";
>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>     <modelVersion>4.0.0</modelVersion>
>     <parent>
>         <groupId>org.springframework.boot</groupId>
>         <artifactId>spring-boot-starter-parent</artifactId>
>         <version>2.1.4.RELEASE</version>
>         <relativePath/> <!-- lookup parent from repository -->
>     </parent>
>     <groupId>com.myapp</groupId>
>     <artifactId>myapp</artifactId>
>     <version>0.0.1-SNAPSHOT</version>
>     <packaging>war</packaging>
>     <name>My_app</name>
>     <description> My_app  </description>
>
>     <properties>
>         <java.version>1.8</java.version>
>         <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
>         <maven.compiler.source>1.8</maven.compiler.source>
>         <maven.compiler.target>1.8</maven.compiler.target>
>     </properties>
>
>     <dependencies>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-data-rest</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-web</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.cloud</groupId>
>             <artifactId>spring-cloud-gcp-starter</artifactId>
>         </dependency>
>
>         <!--mpm -->
>         
>
>         <!-- JPA Data (We are going to use Repositories, Entities, Hibernate, 
> etc...) -->
>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-data-jpa</artifactId>
>         </dependency>
>         
>         <dependency>
>             <groupId>com.google.code.gson</groupId>
>             <artifactId>gson</artifactId>
>         </dependency>
>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-security</artifactId>
>         </dependency>
>         <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt -->
>         <dependency>
>             <groupId>io.jsonwebtoken</groupId>
>             <artifactId>jjwt</artifactId>
>             <version>0.9.1</version>
>         </dependency>
>
>         <dependency>
>             <groupId>org.springframework.cloud</groupId>
>             <artifactId>spring-cloud-gcp-starter-sql-mysql</artifactId>
>         </dependency>       
>         
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-devtools</artifactId>
>             <scope>runtime</scope>
>         </dependency>
>
>         <!-- END mpm -->
>         <dependency>
>             <groupId>mysql</groupId>
>             <artifactId>mysql-connector-java</artifactId>
>             <scope>runtime</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-starter-test</artifactId>
>             <scope>test</scope>
>         </dependency>
>
>         <dependency>
>             <groupId>javax.servlet</groupId>
>             <artifactId>javax.servlet-api</artifactId>
>             <version>3.1.0</version>
>             <scope>provided</scope>
>         </dependency>
>         
>         <dependency>
>             <groupId>com.sendgrid</groupId>
>             <artifactId>sendgrid-java</artifactId>
>         </dependency>
>         
>         <dependency>
>             <groupId>com.paypal.sdk</groupId>
>             <artifactId>checkout-sdk</artifactId>
>             <version>1.0.2</version>
>         </dependency>
>         <dependency>
>             <groupId>javax.xml.bind</groupId>
>             <artifactId>jaxb-api</artifactId>
>             <version>2.3.0</version>
>         </dependency>
>         <dependency>
>             <groupId>com.google.cloud</groupId>
>             <artifactId>google-cloud-storage</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>com.google.firebase</groupId>
>             <artifactId>firebase-admin</artifactId>
>             <version>7.0.0</version>
>         </dependency>
>         <dependency>
>             <groupId>com.google.appengine</groupId>
>             <artifactId>appengine-api-1.0-sdk</artifactId>
>             <version>1.9.63</version>
>         </dependency>
>
>     </dependencies>
>
>     <dependencyManagement>
>         <dependencies>
>             <dependency>
>                 <groupId>org.springframework.cloud</groupId>
>                 <artifactId>spring-cloud-dependencies</artifactId>
>                 <version>${spring-cloud.version}</version>
>                 <type>pom</type>
>                 <scope>import</scope>
>             </dependency>
>         </dependencies>
>     </dependencyManagement>
>
>     <build>
>         <plugins>
>             <plugin>    
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <configuration>
>                     <source>1.8</source>
>                     <target>1.8</target>
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.springframework.boot</groupId>
>                 <artifactId>spring-boot-maven-plugin</artifactId>
>             </plugin>
>             <!-- add appengine-maven-plugin -->
>             <plugin>
>                 <groupId>com.google.cloud.tools</groupId>
>                 <artifactId>appengine-maven-plugin</artifactId>
>                 <version>2.4.0</version>
>                 <configuration>
>                     <projectId>GCLOUD_CONFIG</projectId>
>                     <version>main</version>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
>
> </project>
>
> I don't get any errors just my server responds with a 500 but no details 
> around that, so if anyone can give me any pointers that would be excellent, 
> Thanks in advance
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/42cd8cb8-cf22-4de9-87ca-8fa929e5625en%40googlegroups.com.

Reply via email to