Contentful logo

Contentful Community

Getting error to fetch new created environment

We have 2 active space env (master and develop), We try to create new one named master-test, but when we try to get data from there, we are getting this error,

FAILED REQUEST:\n\tRequest{method=GET, url=https://cdn.contentful.com/spaces/47kib6p5qjep/environments/dev/locales, tags={class retrofit2.Invocation=com.contentful.java.cda.CDAService.array() [47kib6p5qjep, dev, locales, {}]}}\n\t?? Header{Authorization: Bearer XXX, User-Agent: contentful.java/10.4.5(OpenJDK Runtime Environment 11.0.11+9) Linux/5.4.89+, X-Contentful-User-Agent: sdk contentful.java/10.4.5; platform java/11.0.11; os Linux/5.4.89;}\n\tResponse{protocol=h2, code=404, message=, url=https://cdn.contentful.com/spaces/47kib6p5qjep/environments/dev/locales}\n\t?? Body{{\n “sys”: {\n “type”: “Error”,\n “id”: “NotFound”\n },\n “message”: “The resource could not be found.”,\n “details”: {\n “type”: “Environment”,\n “id”: “dev”,\n “space”: “47kib6p5qjep”\n },\n “requestId”: “f39abe41-1029-4740-befa-e678f0d374ac”\n}\n}\n\t?? Header{accept-ranges: bytes, access-control-allow-headers: Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature, access-control-allow-methods: GET,HEAD,OPTIONS, access-control-allow-origin: *, access-control-expose-headers: Etag, access-control-max-age: 86400, age: 9915, cf-environment-id: dev, cf-space-id: 47kib6p5qjep, content-length: 257, content-type: application/vnd.contentful.delivery.v1+json, contentful-api: cda, contentful-cache: MISS, date: Fri, 21 May 2021 11:43:58 GMT, etag: “5948446244772485157”, server: Contentful, vary: Accept-Encoding, via: 1.1 varnish, 1.1 varnish, x-cache: HIT, x-cache-hits: 0, 1, x-content-type-options: nosniff, x-contentful-region: us-east-1, x-contentful-request-id: 89c17432-87ae-4a9a-839f-fd955988034d, x-contentful-route: /spaces/:space/environments/:environment/locales, x-served-by: cache-dca17745-DCA, cache-cdg20740-CDG, x-timer: S1621597439.951025,VS0,VE1}\n\tat com.contentful.java.cda.interceptor.ErrorInterceptor.intercept(ErrorInterceptor.java:28)\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)\n\tat com.contentful.java.cda.interceptor.HeaderInterceptor.intercept(HeaderInterceptor.java:38)\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)\n\tat com.contentful.java.cda.interceptor.HeaderInterceptor.intercept(HeaderInterceptor.java:38)\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)\n\tat com.contentful.java.cda.interceptor.HeaderInterceptor.intercept(HeaderInterceptor.java:38)\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)\n\tat okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)\n\tat okhttp3.RealCall.execute(RealCall.java:81)\n\tat retrofit2.OkHttpCall.execute(OkHttpCall.java:186)\n\tat retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:45)\n\tat io.reactivex.Observable.subscribe(Observable.java:12284)\n\tat io.reactivex.internal.operators.flowable.FlowableFromObservable.subscribeActual(FlowableFromObservable.java:29)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest.subscribeActual(FlowableOnBackpressureLatest.java:32)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableFlatMap.subscribeActual(FlowableFlatMap.java:53)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableFlatMap.subscribeActual(FlowableFlatMap.java:53)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:35)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:35)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableFilter.subscribeActual(FlowableFilter.java:37)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)\n\tat io.reactivex.Flowable.subscribe(Flowable.java:14935)\n\tat io.reactivex.Flowable.blockingFirst(Flowable.java:5698)\n\tat com.openpayd.resourceservice.service.impl.ContentfulServiceImpl.getInformationMessages(ContentfulServiceImpl.java:75)\n\tat com.openpayd.resourceservice.api.controller.ContentfulController.getInformationMessages(ContentfulController.java:42)\n\tat com.openpayd.resourceservice.api.controller.ContentfulController$$FastClassBySpringCGLIB$$fec6625c.invoke()\n\tat org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n\tat org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n\tat org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(( Source)\n

Hi @faruk.guler ,

From the error it seems that the dev environment is called, instead of development. In addition, the API call tries to retrieve locales, meanwhile the right CMA Call to duplicate environment should follow what explained here:

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/environments/environment/create-an-environment-with-a-different-source/console/java