AWS SNS - Subscribe to topic fails - "Application endpoint arn invalid" - amazon-web-services
I want to register an appe-push-token to a topic on AWS SNS (Java / AmazonSDK).
Somewhere is a problem, but I cannot really spot it.
Following are the 3 required parameters (modified, so not valid):
enpoint (Apple Device Token): 6aae03b55912819b69dXXXXXXc75aab27716850XXXXXXe19e2710XXXX4983788
TopicArn: "arn:aws:sns:eu-central-1:1XXXXXXXX4:All_TrXXXXXXt"
Protocol: application
I try to subscribe to my topic like this:
public String subscribeToTopicWithTheNewToken(String pushToken) {
final String topicAllTXXXXXXXt = "arn:aws:sns:eu-central-1:14xxxxxx4:All_TXXXXXXXXt";
//***The following line brings up the exception***
final SubscribeResult application = snsClient.subscribe(topicAllTrXXXXXXt, "application", pushToken);
return application.getSubscriptionArn();
}
I subscribe using the raw topicArn, the raw string "application" and the raw apple device token.
Exception:
com.amazonaws.services.sns.model.InvalidParameterException: Invalid parameter: Application endpoint arn invalid:6aae03b5591281XXXXXX1d6ec75aab2XXXXXXXXXXXXXXXXXXXXXXXc4983788 (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: 3a6dbe8a-9a4e-5177-97f5-ef88f12d2150)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1586) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1254) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1035) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:747) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:721) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:704) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:672) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:654) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:518) ~[aws-java-sdk-core-1.11.80.jar:na]
at com.amazonaws.services.sns.AmazonSNSClient.doInvoke(AmazonSNSClient.java:2065) ~[aws-java-sdk-sns-1.11.80.jar:na]
at com.amazonaws.services.sns.AmazonSNSClient.invoke(AmazonSNSClient.java:2041) ~[aws-java-sdk-sns-1.11.80.jar:na]
at com.amazonaws.services.sns.AmazonSNSClient.subscribe(AmazonSNSClient.java:1941) ~[aws-java-sdk-sns-1.11.80.jar:na]
at com.amazonaws.services.sns.AmazonSNSClient.subscribe(AmazonSNSClient.java:1953) ~[aws-java-sdk-sns-1.11.80.jar:na]
at application.push_messages.PushMessageService.subscribeToTopicWithTheNewToken(PushMessageService.java:76) ~[main/:na]
at application.user.UserService.updateTokenForUser(UserService.java:159) ~[main/:na]
at application.user.UserService$$FastClassBySpringCGLIB$$b712c385.invoke(<generated>) ~[main/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at application.user.UserService$$EnhancerBySpringCGLIB$$4de312b8.updateTokenForUser(<generated>) ~[main/:na]
at application.user.UserController.updatePushMessageToken(UserController.java:86) ~[main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:883) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:651) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at application.security.CorsFilter.doFilterInternal(CorsFilter.java:25) ~[main/:na]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at application.security.CorsFilter.doFilterInternal(CorsFilter.java:25) ~[main/:na]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) ~[spring-security-web-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-embed-core-8.5.5.jar:8.5.5]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.5.jar:8.5.5]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_111]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.5.jar:8.5.5]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
What am I doing wrong? Is my endpoint formatted wrongly? Did I misunderstood some other point? I would really appreciate any kind of hint/help you can provide me with.
I found the problem with the help of #DaveMaple:
I didn't know about "Endpoints". You first need to create an SNS endpoint and subscribe to a topic using this endpoint and NOT the device-token!
So here are the steps:
Create an `AWS - Topic`
Create an `AWS - Application`
Connect to the `AWS - Application` and get an endpoint from there for each device.
Use this endpoint `ARN` to subsribe to you `AWS - Topic`.
From here, you can publish messages over the topic and all connected devices will receive it.
See this link for further information.
Related
TypeError: babelAddon.buildBabelOptions is not a function
I am having an ember application with following ember dependencies and version { "name": "frontend", "version": "0.0.0", "description": "Small description for frontend goes here", "license": "MIT", "author": "", "directories": { "doc": "doc", "test": "tests" }, "repository": "", "scripts": { "build": "ember build", "start": "ember server", "test": "ember test" }, "devDependencies": { "bootstrap": "^4.0.0", "broccoli-asset-rev": "^2.4.5", "ember-ace": "git+https://github.com/adityaU/ember-ace.git", "ember-ajax": "^2.4.1", "ember-api-actions": "0.1.6", "ember-bootstrap": "^1.2.1", "ember-browserify": "^1.2.1", "ember-can": "0.8.4", "ember-chartjs": "0.0.0", "ember-cli": "2.18.0", "ember-cli-app-version": "^2.0.0", "ember-cli-babel": "^5.1.7", "ember-cli-bootstrap-datetimepicker": "^0.6.1", "ember-cli-clipboard": "^0.9.0", "ember-cli-dependency-checker": "^1.3.0", "ember-cli-document-title": "^0.4.0", "ember-cli-echarts": "^0.1.7", "ember-cli-htmlbars": "^1.1.1", "ember-cli-htmlbars-inline-precompile": "^0.3.3", "ember-cli-inject-live-reload": "^1.4.1", "ember-cli-jshint": "^2.0.1", "ember-cli-moment-shim": "^3.5.0", "ember-cli-pace": "0.1.0", "ember-cli-pagination": "3.0.0", "ember-cli-qunit": "^3.0.1", "ember-cli-react": "^0.3.0", "ember-cli-release": "^0.2.9", "ember-cli-sass": "6.1.1", "ember-cli-shims": "^1.0.2", "ember-cli-simditor": "0.0.8", "ember-cli-sri": "^2.1.0", "ember-cli-test-loader": "^1.1.0", "ember-cli-uglify": "^1.2.0", "ember-cookies": "0.0.13", "ember-data": "2.18.0", "ember-export-application-global": "^1.0.5", "ember-fullcalendar": "^1.7.0", "ember-gridstack": "1.0.1", "ember-keyboard-shortcuts": "^1.0.5", "ember-light-table": "1.8.3", "ember-load-initializers": "^0.6.0", "ember-lodash": "^4.17.2", "ember-moment": "7.3.0", "ember-multiselect-checkboxes": "^0.10.3", "ember-popper": "0.9.0", "ember-resolver": "^2.0.3", "ember-responsive": "2.0.1", "ember-searchable-select": "^0.11.0", "ember-semantic-ui-calendar": "0.0.3", "ember-source": "2.18.0", "ember-toastr": "1.5.0", "ember-vcl-plotly": "github:ember-vcl/plotly", "ember-welcome-page": "^2.0.2", "eonasdan-bootstrap-datetimepicker": "^4.17.47", "loader.js": "^4.0.10", "moment": "^2.22.0", "moment-timezone": "^0.5.14", "react": "^15.6.2", "react-dom": "^15.6.2", "semantic-ui-ember": "2.0.1" }, "engines": { "node": ">= 0.12.0" }, "private": true, "dependencies": { "react-pivottable": "^0.3.1", "react-plotly.js": "^2.1.0", "jquery": "3.3.1", "bootstrap": "^4.0.0" } } I run yarn to fetch all dependencies and it worked perfectly fine but when I run the ember application I am getting babelAddon.buildBabelOptions is not a function Below is the complete log. - broccoliBuilderErrorStack: [undefined] - code: [undefined] - codeFrame: [undefined] - errorMessage: babelAddon.buildBabelOptions is not a function - errorType: [undefined] - location: - column: [undefined] - file: [undefined] - line: [undefined] - message: babelAddon.buildBabelOptions is not a function - name: TypeError - nodeAnnotation: [undefined] - nodeName: [undefined] - originalErrorMessage: [undefined] - stack: TypeError: babelAddon.buildBabelOptions is not a function at Package.buildBabelOptions (/Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-auto-import/js/package.js:47:39) at new Package (/Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-auto-import/js/package.js:30:46) at Function.lookup (/Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-auto-import/js/package.js:38:35) at new AutoImport (/Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-auto-import/js/auto-import.js:26:45) at Function.lookup (/Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-auto-import/js/auto-import.js:39:27) at Class.included (/Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-auto-import/js/index.js:26:48) at Class.superWrapper [as included] (/Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-cli/node_modules/core-object/lib/assign-properties.js:34:20) at /Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-cli/lib/models/addon.js:405:26 at Array.reduce (<anonymous>) at Class.eachAddonInvoke (/Users/sahilpaudel/Documents/PharmEasy/Elixir/AfterGlow/frontend/node_modules/ember-cli/lib/models/addon.js:402:24) Any help please.
How to I fix these errors not import some modules in qarsar testing with jest?
I am trying to implement testing for my quasar project with jest. But I have some issues to not import modules. When I run testing project, It can not import modules. How to fix it? I am beginner so please share about this correctly and deeply. I am very thanks to help me to fix it. These my errors. E:\workplace\unittesting\webboid\node_modules\#babel\runtime-corejs2\helpers\esm\asyncToGenerator.js:1 ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import _Promise from "../../core-js/promise"; ^^^^^^^^ SyntaxError: Unexpected identifier 17 | q-icon.on-right(name="show_chart") 18 | q-btn( v-if="local" flat style="margin-right:10px;" #click="ipcRenderer.send('openURL','https://app.boid.com')") > 19 | q-icon(name="home") | ^ 20 | q-btn( v-else flat style="margin-right:10px;" #click="$router.push('/')") 21 | q-icon(name="home") 22 | q-btn.text-black(#click='' flat v-if="authenticated", color='light') at ScriptTransformer._transformAndBuildScript (node_modules/#jest/transform/build/ScriptTransformer.js:471:17) at ScriptTransformer.transform (node_modules/#jest/transform/build/ScriptTransformer.js:513:25) at src/App.vue:19:49 at Object.<anonymous> (src/App.vue:535:3) My jest.config.js File is following. module.exports = { globals: { __DEV__: true, }, verbose: false, // false since we want to see console.logs inside tests bail: false, testURL: 'http://localhost/', testEnvironment: 'jsdom', testRegex: './src/__unit__/.*.js$', rootDir: '.', testPathIgnorePatterns: [ '<rootDir>/components/coverage/', '<rootDir>/test/cypress/', '<rootDir>/test/coverage/', '<rootDir>/dist/', '<rootDir>/node_modules/', ], moduleFileExtensions: ['js', 'json', 'vue'], moduleNameMapper: { '^vue$': 'vue/dist/vue.common.js', 'quasar': 'quasar-framework/dist/umd/quasar.mat.umd.js', }, resolver: null, transformIgnorePatterns: [ 'node_modules/core-js', 'node_modules/babel-runtime', 'node_modules/vue', ], transform: { '^.+\\.js$': '<rootDir>/node_modules/babel-jest', '.*\\.(vue)$': '<rootDir>/node_modules/vue-jest', } } My package.json is following. "devDependencies": { "#babel/core": "^7.4.5", "#babel/plugin-proposal-class-properties": "^7.0.0", "#babel/plugin-proposal-decorators": "^7.0.0", "#babel/plugin-proposal-export-namespace-from": "^7.0.0", "#babel/plugin-proposal-function-sent": "^7.0.0", "#babel/plugin-proposal-json-strings": "^7.0.0", "#babel/plugin-proposal-numeric-separator": "^7.0.0", "#babel/plugin-proposal-throw-expressions": "^7.0.0", "#babel/plugin-syntax-dynamic-import": "^7.0.0", "#babel/plugin-syntax-import-meta": "^7.0.0", "#babel/plugin-transform-runtime": "^7.0.0", "#babel/preset-env": "^7.0.0", "autoprefixer": "^6.4.0", "babel-core": "^7.0.0-bridge.0", "babel-jest": "^24.8.0", "babel-loader": "^8.0.0", "babel-plugin-add-module-exports": "^1.0.0", "colors": "^1.1.2", "connect-history-api-fallback": "^1.1.0", "css-loader": "^0.28.7", "es6-promise": "^4.1.1", "eslint": "^4.8.0", "eslint-config-standard": "^10.2.1", "eslint-friendly-formatter": "^3.0.0", "eslint-loader": "^1.9.0", "eslint-plugin-html": "^3.2.2", "eslint-plugin-import": "^2.7.0", "eslint-plugin-node": "^5.2.0", "eslint-plugin-promise": "^3.5.0", "eslint-plugin-standard": "^3.0.1", "eventsource-polyfill": "^0.9.6", "express": "^4.16.1", "extract-text-webpack-plugin": "^3.0.0", "file-loader": "^0.11.1", "friendly-errors-webpack-plugin": "^1.1.3", "glob": "^7.1.2", "html-webpack-plugin": "^2.30.1", "http-proxy-middleware": "^0.17.0", "jest": "^24.8.0", "json-loader": "^0.5.7", "opn": "^5.0.0", "optimize-css-assets-webpack-plugin": "^3.2.0", "postcss-loader": "^1.0.0", "progress-bar-webpack-plugin": "^1.10.0", "purify-css": "^1.2.6", "shelljs": "^0.7.0", "stylus": "^0.54.5", "stylus-loader": "^3.0.1", "url-loader": "^0.5.7", "vue-jest": "^3.0.4", "vue-loader": "^13.0.5", "vue-style-loader": "^3.0.3", "vue-template-compiler": "^2.5.0", "webpack": "^3.10.0", "webpack-bundle-analyzer": "^3.1.0", "webpack-dev-middleware": "^1.12.0", "webpack-hot-middleware": "^2.19.1", "webpack-merge": "^4.1.0"
error while running ionic ios build --prod --release (#ionic-native/core/decorators.d.ts, found version 4, expected 3)
I ran the following command: ionic ios build --prod --release And received the following error: Error: Metadata version mismatch for module d:/ionic/event/node_modules/#ionic-native/core/decorators.d.ts, found version 4, expected 3 at StaticSymbolResolver.getModuleMetadata (d:\ionic\event\node_modules\#angular\compiler\bundles\compiler.umd.js:24474:34) at StaticSymbolResolver._createSymbolsOf (d:\ionic\event\node_modules\#angular\compiler\bundles\compiler.umd.js:24260:46) at StaticSymbolResolver.getSymbolsOf (d:\ionic\event\node_modules\#angular\compiler\bundles\compiler.umd.js:24241:14) at d:\ionic\event\node_modules\#angular\compiler\bundles\compiler.umd.js:23023:30 at Array.forEach (<anonymous>) at extractProgramSymbols (d:\ionic\event\node_modules\#angular\compiler\bundles\compiler.umd.js:23022:79) at AotCompiler.compileAll (d:\ionic\event\node_modules\#angular\compiler\bundles\compiler.umd.js:22720:47) at CodeGenerator.codegen (d:\ionic\event\node_modules\#angular\compiler-cli\src\codegen.js:30:14) at Function.NgTools_InternalApi_NG_2.codeGen (d:\ionic\event\node_modules\#angular\compiler-cli\src\ngtools_api.js:61:30) at d:\ionic\event\node_modules\#ionic\app-scripts\dist\aot\aot-compiler.js:182:73 Here are my dependencies: "dependencies": { "#angular/common": "4.1.2", "#angular/compiler": "4.1.2", "#angular/compiler-cli": "4.1.2", "#angular/core": "4.1.2", "#angular/forms": "4.1.2", "#angular/http": "4.1.2", "#angular/platform-browser": "4.1.2", "#angular/platform-browser-dynamic": "4.1.2", "#ionic-native/core": "^4.11.0", "#ionic-native/file": "4.11.0", "#ionic-native/file-transfer": "4.11.0", "#ionic-native/google-maps": "4.9.1", "#ionic-native/keyboard": "4.11.0", "#ionic-native/splash-screen": "4.11.0", "#ionic-native/sqlite": "4.11.0", "#ionic-native/status-bar": "4.11.0", "#ionic-native/transfer": "3.14.0", "#ionic/storage": "2.0.1", "cordova-android": "6.3.0", "cordova-plugin-compat": "1.2.0", "cordova-plugin-console": "1.0.5", "cordova-plugin-device": "1.1.4", "cordova-plugin-file": "4.3.3", "cordova-plugin-file-transfer": "1.7.1", "cordova-plugin-googlemaps": "1.4.5", "cordova-plugin-splashscreen": "~4.0.1", "cordova-plugin-statusbar": "2.2.2", "cordova-plugin-whitelist": "1.3.1", "cordova-sqlite-storage": "~2.0.4", "ionic-angular": "3.3.0", "ionic-plugin-keyboard": "2.2.1", "ionicons": "3.0.0", "ng2-translate": "5.0.0", "rxjs": "5.5.11", "sw-toolbox": "3.6.0", "zone.js": "0.8.11" } What am I doing wrong?
Cannot run tests (jasmine, karma, webpack)
I've been trying for a couple of days now to get some tests to run. I've two environments, one very "empty" and another with a full project. The 'empty' one does run a very simple test (but doesn't contain the Person object that is unable to be constructed in the full project). I migrated the full project to a very similar environment in terms of installed dev packages, karma, jasmine versions and such. I also copied the tsconfig.json, karma.conf files across. Those are below. For the life of me I cannot figure out why the karma tests will not run. With previous versions of Karma I would get an error along the lines of 'scheduler_person.b' is not a constructor. Digging a little deeper, it's failing on this line of test.store.ts: let neil: Person = new Person("Neil Clayton"); the constructor of this object is: constructor(name: string = "put name here") { super(); this.name = name; this.primary_roles = new Map<Role, number>(); this.specific_roles = new Map<string, Array<Role>>(); this.secondary_action_list = []; this.condition_rules = []; this.unavailable = []; this.prefs = new SchedulePrefs(); } So, the Person class has a constructor, and this code does run within the app itself. I have since upgraded all of karma/jasmine and the error now changes to: VM105 karma-test-shim.js:629 Uncaught TypeError: $f.b is not a constructor Looking at the generated code, it's essentially exactly the same inability to call a constructor. I feel I must be doing something very simple, very stupid, but I cannot see it. Any ideas? (btw: this project is at https://github.com/scornflake/scheduler) tsconfig.json { "compilerOptions": { "allowSyntheticDefaultImports": true, "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitThis": true, "lib": [ "dom", "es2015", "esnext.asynciterable" ], "module": "es2015", "moduleResolution": "node", "sourceMap": true, "target": "es5" }, "include": [ "src/**/*.ts" ], "exclude": [ "node_modules", "src/**/*.spec.ts" ], "typeAcquisition": { "enable": true, "include": [ "./src/common/fix.broken.gapi.types.d.ts" ] }, "compileOnSave": false, "atom": { "rewriteTsconfig": false } } karma.config.json const webpackConfig = require('./webpack.test.js'); module.exports = function (config) { const _config = { basePath: '', frameworks: [ 'jasmine' // 'jasmine-matchers' ], files: [ { pattern: './karma-test-shim.js', watched: true } ], preprocessors: { './karma-test-shim.js': ['webpack', 'sourcemap'] }, webpack: webpackConfig, webpackMiddleware: { stats: 'errors-only' }, webpackServer: { noInfo: true }, browserConsoleLogOptions: { level: 'log', format: '%b %T: %m', terminal: true }, // reporters: ['kjhtml', 'dots'], reporters: ['dots'], // reporters: ['kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }; config.set(_config); }; karma-test-shim.js Error.stackTraceLimit = Infinity; require('core-js/es6'); require('core-js/es7/reflect'); require('zone.js/dist/zone'); require('zone.js/dist/long-stack-trace-zone'); require('zone.js/dist/proxy'); require('zone.js/dist/sync-test'); require('zone.js/dist/jasmine-patch'); require('zone.js/dist/async-test'); require('zone.js/dist/fake-async-test'); var appContext = require.context('../src', true, /\.spec\.ts/); appContext.keys().forEach(appContext); var testing = require('#angular/core/testing'); var browser = require('#angular/platform-browser-dynamic/testing'); testing.TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting()); package.json { "name": "scheduler", "version": "0.0.1", "author": "Neil Clayton", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build --copy ./config/copy.config.js", "lint": "ionic-app-scripts lint", "ionic:build": "ionic-app-scripts build --copy ./config/copy.config.js", "ionic:serve": "ionic-app-scripts serve --copy ./config/copy.config.js", "test-coverage": "ng test --code-coverage", "test": "ng test" }, "dependencies": { "#angular/common": "5.0.3", "#angular/compiler": "5.0.3", "#angular/compiler-cli": "5.0.3", "#angular/core": "5.0.3", "#angular/forms": "5.0.3", "#angular/http": "5.0.3", "#angular/platform-browser": "5.0.3", "#angular/platform-browser-dynamic": "5.0.3", "#ionic-native/core": "4.3.2", "#ionic-native/splash-screen": "4.3.2", "#ionic-native/status-bar": "4.3.2", "#ionic/storage": "2.1.3", "#types/gapi": "^0.0.35", "#types/gapi.auth2": "^0.0.47", "#types/gapi.client": "^1.0.0", "#types/gapi.client.drive": "^3.0.1", "#types/gapi.client.sheets": "^4.0.0", "angular-pipes": "^6.5.3", "apollo-angular": "^1.0.1", "apollo-angular-link-http": "^1.0.2", "apollo-cache-inmemory": "^1.1.12", "apollo-client": "^2.2.8", "apollo-link": "^1.2.2", "cordova-browser": "5.0.1", "cordova-plugin-device": "^1.1.4", "cordova-plugin-ionic-webview": "^1.1.16", "cordova-plugin-splashscreen": "^4.0.3", "cordova-plugin-whitelist": "^1.3.1", "file-saver": "^1.3.8", "google-auth-library": "^1.4.0", "googleapis": "^28.1.0", "graphql": "^0.13.2", "graphql-tag": "^2.8.0", "ionic-angular": "3.9.2", "ionic-configuration-service": "^6.0.0", "ionic-logging-service": "^5.0.0", "ionic-plugin-keyboard": "^2.2.1", "ionicons": "3.0.0", "json2csv": "^3.11.5", "lodash": "^4.17.4", "mobx": "^4.1.1", "mobx-angular": "^3.0.1", "moment": "^2.20.1", "ng-circle-progress": "^0.9.9", "rxjs": "5.5.2", "short-unique-id": "^1.1.0", "sw-toolbox": "3.6.0", "to-case": "^2.0.0", "zone.js": "^0.8.26" }, "devDependencies": { "#ionic/app-scripts": "3.1.6", "#types/jasmine": "2.8.4", "#types/node": "8.5.8", "angular2-template-loader": "^0.6.2", "file-save": "^0.2.0", "html-loader": "^0.5.5", "jasmine-core": "3.1.0", "jasmine-expect": "^3.8.3", "jasmine-spec-reporter": "^4.1.0", "karma": "^2.0.2", "karma-chrome-launcher": "^2.2.0", "karma-jasmine": "^1.1.1", "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^3.0.0", "null-loader": "^0.1.1", "protractor": "5.3.0", "ts-loader": "^4.2.0", "ts-node": "4.1.0", "typescript": "2.4.2", "webpack": "^4.6.0" }, "description": "Scheduler", "cordova": { "plugins": { "ionic-plugin-keyboard": {}, "cordova-plugin-whitelist": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": {} }, "platforms": [ "browser" ] } } Finally, some pics of the browser errors:
In src/providers/store/test.store.ts you need to move all of your global constants (and subsequent method calls) into the SetupStore method of the NPBCStoreConstruction class. When I do this I can run the test suite properly. The cause of issue is that when Webpack/Typescript/something compiles everything, it picks an arbitrary order to include all the files and if you look at the generated code you can see that the global invocation of the person Person constructor happens before it is defined.
Ember 1.11 upgrade from 1.8
I'm trying to update an app from ember 1.8.1 to 1.11.1. When I run ember serve I get the following error in my console: Uncaught Error: Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`. I have tried following all of these guides: http://emberjs.com/blog/2014/10/16/handlebars-update.html, http://emberjs.com/blog/2015/02/05/compiling-templates-in-1-10-0.html, https://github.com/rwjblue/components-in-subdirs/commit/78e7ed2d072f42d9cf0fd3d9fc2376f106ab762e. In particular I have definitely updated to ember-cli-htmlbars, yet I still get this error. I have tried adding this line to bower.son but with no luck: "ember-template-compiler": "http://builds.emberjs.com/tags/v1.11.1/ember-template-compiler.js" My package.json and bower.json, and Brocfile.js are below. Any ideas would be greatly appreciated! Many thanks * UPDATE * The problem was with ember-cli-bootstrap. Removing that fixed the issue. package.json { "name": "mercury-ember", "version": "0.0.0", "description": "Small description for mercury-ember goes here", "private": true, "directories": { "doc": "doc", "test": "tests" }, "scripts": { "start": "ember server", "build": "ember build", "test": "ember test" }, "repository": "", "engines": { "node": ">= 0.10.0" }, "author": "", "license": "MIT", "devDependencies": { "aws-sdk": "^2.1.18", "broccoli-asset-rev": "^2.0.0", "ember-cli": "0.2.3", "ember-cli-babel": "^5.0.0", "ember-cli-app-version": "0.3.1", "ember-cli-bootstrap": "0.0.15", "ember-cli-cordova": "0.0.16", "ember-cli-dependency-checker": "0.0.7", "ember-cli-font-awesome": "0.0.9", "ember-cli-form-data": "0.0.8", "ember-cli-htmlbars": "^0.7.0", "ember-cli-ic-ajax": "0.1.1", "ember-cli-inject-live-reload": "^1.3.0", "ember-cli-ion-rangeslider": "0.0.5", "ember-cli-qunit": "0.3.1", "ember-cli-simple-auth": "^0.7.3", "ember-cli-simple-auth-devise": "^0.7.3", "ember-cli-simple-auth-testing": "0.7.3", "ember-cli-uglify": "1.0.1", "ember-cli-uploader": "^0.3.4", "ember-data": "1.0.0-beta.12", "ember-export-application-global": "^1.0.0", "ember-select-2": "1.2.0", "emberx-slider": "1.0.3", "express": "^4.8.5", "glob": "^4.0.5", "initials-avatar": "0.0.8", "liquid-fire": "^0.17.1" } } bower.json { "name": "mercury-ember", "dependencies": { "ember": "1.11.1", "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", "ember-data": "1.0.0-beta.16.1", "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4", "ember-qunit": "0.1.8", "ember-qunit-notifications": "0.0.7", "ember-resolver": "~0.1.15", "jquery": "^1.11.1", "loader.js": "ember-cli/loader.js#3.2.0", "qunit": "~1.17.1", "ember-simple-auth": "0.7.3", "moment": "~2.9.0", "bootstrap": "~3.3", "ember-addons.bs_for_ember": "~0.7.0", "ionrangeslider": "~2.0.6", "select2": "~3.5.2", "ember-uploader": "0.3.4", "aws-sdk-js": "2.1.18", "ember-inflector": "~1.3.1" } } Brocfile.js: /* global require, module */ var EmberApp = require('ember-cli/lib/broccoli/ember-app'); var app = new EmberApp({ 'ember-cli-bootstrap': { 'importBootstrapJS': true } }); module.exports = app.toTree();
After adding "ember-template-compiler": "http://builds.emberjs.com/tags/v1.11.1/ember-template-compiler.js" then include it in Brocfile.js with adding app.import('bower_components/ember-template-compiler/index.js'); before module.exports = app.toTree();