This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-12
Channels
- # announcements (9)
- # babashka (2)
- # beginners (27)
- # clojure (19)
- # clojure-bay-area (1)
- # clojure-germany (7)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojurescript (6)
- # conjure (1)
- # datomic (10)
- # fulcro (11)
- # graalvm (1)
- # introduce-yourself (3)
- # jobs (1)
- # luminus (1)
- # malli (9)
- # off-topic (23)
- # podcasts-discuss (3)
- # polylith (6)
- # practicalli (1)
- # re-frame (14)
- # sci (2)
- # shadow-cljs (5)
I'm back to fiddlig with my datomic cloud solo instance, has anyone run into this cors issues on a solo toplogy? I cant think of a reasonable next step. https://forum.datomic.com/t/cors-issue/1870
I believe i'm dealing with a lambda, so https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html "enabling cors support for lambda..." would be relevent. i created an option method, though i suppose i should test that theory.
https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-test-cors.html Looks like it might be useful, ill try to get some feedback next.
Have you read through https://docs.datomic.com/cloud/tech-notes/cors-lambda-proxy.html
I see in your forum post you have seen the tech note. Since you can successfully curl the end point. When you do that locally do you receive the expected headers?
@U0508JRJC thanks a lot for the response. It looks like i do get the expected headers from curl:
< HTTP/2 200
< date: Sun, 13 Jun 2021 00:39:24 GMT
< content-type: application/edn
< content-length: 847
< x-amzn-requestid: ef6a364c-55a7-430b-a2c0-8b2ede0e7bc5
< access-control-allow-origin: *
< access-control-allow-headers: Authorization, Content-Type
< x-amz-apigw-id: A1oFbEOxiYcFutA=
< access-control-allow-methods: GET, PUT, PATCH, POST, DELETE, OPTIONS
< x-amzn-trace-id: Root=1-60c553bc-5652c3b90fe79f8437318ff7;Sampled=0
<
full curl with -v (let me know if i need to pass more options)
➜ ion-starter git:(add-pomodoro-mode) curl -v -d :hat
* Trying 3.23.22.174:443...
* TCP_NODELAY set
* Connected to (3.23.22.174) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=*.
* start date: Aug 29 00:00:00 2020 GMT
* expire date: Sep 28 12:00:00 2021 GMT
* subjectAltName: host "" matched cert's "*."
* issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55ebe17c7e10)
> POST /dev/datomic/ HTTP/2
> Host:
> user-agent: curl/7.68.0
> accept: */*
> content-length: 4
> content-type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
* We are completely uploaded and fine
< HTTP/2 200
< date: Sun, 13 Jun 2021 00:39:24 GMT
< content-type: application/edn
< content-length: 847
< x-amzn-requestid: ef6a364c-55a7-430b-a2c0-8b2ede0e7bc5
< access-control-allow-origin: *
< access-control-allow-headers: Authorization, Content-Type
< x-amz-apigw-id: A1oFbEOxiYcFutA=
< access-control-allow-methods: GET, PUT, PATCH, POST, DELETE, OPTIONS
< x-amzn-trace-id: Root=1-60c553bc-5652c3b90fe79f8437318ff7;Sampled=0
<
[[#:inv{:sku "SKU-51", :size :small, :color :yellow}]
[#:inv{:sku "SKU-47", :size :xlarge, :color :blue}]
[#:inv{:sku "SKU-39", :size :medium, :color :blue}]
[#:inv{:sku "SKU-19", :size :small, :color :green}]
[#:inv{:sku "SKU-55", :size :medium, :color :yellow}]
[#:inv{:sku "SKU-15", :size :xlarge, :color :red}]
[#:inv{:sku "SKU-35", :size :small, :color :blue}]
[#:inv{:sku "SKU-27", :size :large, :color :green}]
[#:inv{:sku "SKU-63", :size :xlarge, :color :yellow}]
[#:inv{:sku "SKU-3", :size :small, :color :red}]
[#:inv{:sku "SKU-43", :size :large, :color :blue}]
[#:inv{:sku "SKU-59", :size :large, :color :yellow}]
[#:inv{:sku "SKU-31", :size :xlarge, :color :green}]
[#:inv{:sku "SKU-7", :size :medium, :color :red}]
[#:inv{:sku "SKU-11", :size :large, :color :red}]
[#:inv{:sku "SKU-23", :size :medium, :color :green}]]
* Connection #0 to host left intact
Maybe my js/fetch call is off? the content-type? I don't see why that would be a cors issues.I do believe your issue is with the fetch call. You want to provide js as the argument. Perhaps something like
(js/fetch " "
(clj->js {:mode "cors"
:method "POST"
:headers {"Content-Type" "text/plain"}
:body ":hat"}))
Your clearly right that I would need to pass the map to clj to js. I was using lambs island fetch and I forgot to change the args when I switched to pure JS.
Happens to all of us 🙂