Can some one advice how do I run 'metano ui' over ...
# announcements
n
Can some one advice how do I run 'metano ui' over https
d
Do you have experience with nginx or another reverse proxy? You can use it to handle SSL termination on port 443 and then forward the requests to the regular
meltano ui
server at port 5000
n
yes I do have some experience in that, i am trying to get the POC production env. for now i don't mind running it in http but i am having problems, I have
MELTANO_UI_AUTHENTICATION=true
i get
Authentication is enabled, but your configuration is currently insecure:
so i added
MELTANO_UI_SESSION_COOKIE_DOMAIN="<http://sub.domain.co.uk|sub.domain.co.uk>"
but now i get
The CSRF tokens do not match.
and if i add
MELTANO_UI_SERVER_NAME="<http://sub.domain.co.uk|sub.domain.co.uk>
the ui does not start (i do not get that green url in cmd) and on browser i get 404
d
All right, you're getting close 🙂 Did you see https://meltano.com/docs/production.html#meltano-ui? Specifically:
If you will be running Meltano UI behind a front-end (reverse) proxy that will be responsible for SSL termination (HTTPS), it is recommended that you enable the `ui.session_cookie_secure` setting so that session cookies used for authentication are only sent along with secure requests.
You may also need to change the `ui.forwarded_allow_ips` setting to get Meltano UI to realize it should use the
https
URL scheme rather than
http
in the URLs it builds.
The CSRF error suggests that the cookie domain or secure flag doesn't match
And I assume you're on the latest Meltano with a fix for this issue? https://gitlab.com/meltano/meltano/-/issues/2307
n
yes i am 🙂
meltano, version 1.58.0
i have tried it with
MELTANO_UI_SESSION_COOKIE_SECURE="true"
MELTANO_UI_FORWARDED_ALLOW_IPS="*"
Its just i am not sure about which combination of things work (i think) With regards to https://gitlab.com/meltano/meltano/-/issues/2307 it is only if you want to serve it over https?
d
What symptoms are you seeing right now? Still the CSRF error? And can you please share the value of all of your
ui.*
settings? You can find them in
meltano config meltano
n
So my current setting are
Copy code
MELTANO_DATABASE_URI="postgresql://......"
MELTANO_UI_SECRET_KEY="8cb......"
MELTANO_UI_PASSWORD_SALT="a0....."
MELTANO_UI_AUTHENTICATION="true"
MELTANO_UI_SESSION_COOKIE_DOMAIN="<http://SUB.DOMAIN.co.uk|SUB.DOMAIN.co.uk>"
MELTANO_UI_SESSION_COOKIE_SECURE="true"
MELTANO_UI_FORWARDED_ALLOW_IPS="*"
and i am still getting CSRF token do not match
I am running the meltano in ubuntu VM and accessing the ui from win-host browser
d
OK, that's the same error we saw in https://gitlab.com/meltano/meltano/-/issues/2307, and there the reason was that Flask could not find its own session cookie because the secure flag was set even though the connection was not over https, which was causing Chrome to refuse to store the cookie
So the fact that we're seeing the same error suggests to me that Flask is again not able to read back its own session cookie because its failing to receive the same cookie it tried to store one request ago
Your browser's Console or Network tab may share some insights
It would be useful to see the
Set-Cookie
header on the first request's response, and the
Cookies
header on the second request, that ends up showing the CSRF error
And you're accessing Meltano at exactly
<https://sub.domain.co.uk/>
, without an additional port or anything?
n
the default 5000 so its http://sub.domain.co.uk:5000
d
OK! Then try adding
:5000
to the
ui.server_name
and/or
ui.session_cookie_name
n
i have added
MELTANO_UI_SESSION_COOKIE_DOMAIN="<http://sub.domain.co.uk:5000|sub.domain.co.uk:5000>"
MELTANO_UI_SERVER_NAME="<http://sub.domain.co.uk:5000|sub.domain.co.uk:5000>"
still CSRF
for the
Cookie
i need to check
Set-Cookie
in response headers for first sub.domain.co.uk and login?next=%2F and
Set-Cookie
on the page after i get CSRF error (once i click login) Do all three suppose to be same?
d
Set-Cookie
in the
/
and login page response headers,
Cookies
in the error page request headers
They're not supposed to match exactly, but you should see the same cookie represented
n
😞 i do not have
Cookies
  in the error page request headers
d
OK, so that suggests that indeed the
Set-Cookie
didn't "work"
Do you see any warning in your Web Inspector's Network or Console tab about that Set-Cookie header?
Could you share the Set-Cookie contents with me?
n
First meltano.m-eat.co.uk response headers Set-Cookie: session=eyJfZmxhc2hlcyI6W3siIHQiOlsiaW5mbyIsIlBsZWFzZSBsb2cgaW4gdG8gYWNjZXNzIHRoaXMgcGFnZS4iXX1dfQ.X7RTCA.0uS5g_4YDkqHxYSQHhWNHp83xxk; Domain=meltano.m-eat.co.uk; Secure; HttpOnly; Path=/ login?next=%2F response headers Set-Cookie: session=eyJjc3JmX3Rva2VuIjoiNmE1ZGU3YTM0MjJjYmQwZDFlNzYyYTViOTgyYWZmMGY1OWM2MzFkYSJ9.X7RTCA.xq8yy1EjyjxSWXY0-4e82kH2CmA; Domain=meltano.m-eat.co.uk; Secure; HttpOnly; Path=/ ============ after log in (error page): response headers Set-Cookie: session=eyJjc3JmX3Rva2VuIjoiYWRkMGIxOTFhMmI2Yjk5NmFjNTQ3MjczOTAyYzdjMjU3ZDY5NDMyMiJ9.X7RTrA
d
OK, so the fact that it's different each time is also consistent with the fact that it couldn't read back the current cookie
n
if i remove
Copy code
MELTANO_UI_SESSION_COOKIE_DOMAIN="<http://meltano.m-eat.co.uk:5000|meltano.m-eat.co.uk:5000>"
MELTANO_UI_SERVER_NAME="<http://meltano.m-eat.co.uk:5000|meltano.m-eat.co.uk:5000>"
MELTANO_UI_SESSION_COOKIE_SECURE="true"
MELTANO_UI_FORWARDED_ALLOW_IPS="*"
The i can log in normally without any problem (apart from "Authentication is enabled, but your configuration is currently insecure:")
d
What does the Set-Cookie header look like now?
What
Domain
?
n
http://meltano.m-eat.co.uk:5000 (i omitted domain earlier to not to advertise 🙂 but i think keeping actual domain i am using makes thing easier to understand ) These are the cookies (can login with out errors) Set-Cookie: session=eyJfZmxhc2hlcyI6W3siIHQiOlsiaW5mbyIsIlBsZWFzZSBsb2cgaW4gdG8gYWNjZXNzIHRoaXMgcGFnZS4iXX1dfQ.X7RW2A.wrmlduJKwlII1m9dnzb8zugB9_c; HttpOnly; Path=/ Set-Cookie: session=eyJfZnJlc2giOmZhbHNlLCJjc3JmX3Rva2VuIjoiMjA3ZGQ4YTY0YjcyNTg5ZThmZmI1ZmNiMWRkMTRhNmUwNDU4MTYxMyJ9.X7RW2Q._S1LXAbfx0xlGQs_vdj_0BO-BD0; HttpOnly; Path=/ After log in (no error) Cookie: session=eyJfZnJlc2giOmZhbHNlLCJjc3JmX3Rva2VuIjoiMjA3ZGQ4YTY0YjcyNTg5ZThmZmI1ZmNiMWRkMTRhNmUwNDU4MTYxMyJ9.X7RW2Q._S1LXAbfx0xlGQs_vdj_0BO-BD0
d
OK, so it looks like the
Domain
in the "secured"
Set-Cookie
is the problem
It may seem confusing that
Domain=<http://meltano.m-eat.co.uk|meltano.m-eat.co.uk>
doesnt include the
5000
port you satisfied, but I double checked and ports are ignored for cookies, only the domain counts
So
Domain=<http://meltano.m-eat.co.uk|meltano.m-eat.co.uk>
should be good, assuming your browser is accessing it at
<https://meltano.m-eat.co.uk>:<any port>
But this also means that you don't need the
:5000
in your
ui.session_cookie_domain
Only in the server name
I think it's a question for your browser at this point why it's not sending the
Set-Cookie
with
Domain
along in the
Cookies
on the next request
n
If i look at
cookies
tab i can see the domain
message has been deleted
After log in
d
Yeah that all looks right. I assume it's showing the default if it's not explicitly included in the
Set-Cookie
definition
It's odd that the default is equal to the Domain we're trying to set explicitly which is calling things to fail
The only other difference is the Secure flag
But if you're using HTTPS, the secure flag should be a good things
To get things to break again, do you need to set either or both of
MELTANO_UI_SESSION_COOKIE_DOMAIN="<http://meltano.m-eat.co.uk|meltano.m-eat.co.uk>"
MELTANO_UI_SESSION_COOKIE_SECURE="true"
?
n
i am not using HTTPS, currently its HTTP. let me check which one breaks again 🙂
d
At least make sure the Secure flag matches whether you're currently using HTTPS or not 🙂
n
🙂 ok
MELTANO_UI_SESSION_COOKIE_SECURE="true"
own its own breaks things (the secure box is ticked, but in cmd i see "Authentication is enabled, but your configuration is currently insecure" first image)
MELTANO_UI_SESSION_COOKIE_DOMAIN="<http://meltano.m-eat.co.uk|meltano.m-eat.co.uk>"
Does not break things (with this i do not see the tick in secure box, second image)
d
Does the "i" say anything on hover?
n
This cookie was blocked because it had the "secure" attribute but was not received over secure connection
d
😄 OK, I think I was assuming you were accessing over HTTPS the whole time since that's what sparked the conversation
Secure only makes sense if using HTTPS, and breaks things otherwise
n
but in order to set secure we need reverse proxy? (I thought there was some confusion that is why i said i was using HTTP) mean we were trying to solve problem that does not exist 😂
d
Yeah we need a reverse proxy to actually get https (SSL) to work on that subdomain of yours, unless it's already behind cloudflare or something
And once we can access it over https, we need the secure flag on the cookie
Did we just go in circles for an hour lol?
n
I guess so 😄 (sorry for wasting your time, but i learned a lot about cookies today)
d
No worries, happy to help 😛
n
ok lets do this you choose a issue that is pending (may be some low hanging fruit that i can do 😁) and assign it to me 🙂
d
n
awesome I like things in order.
d
Haha good
I've assigned it to you!
By the way, I've been crediting you for your contributions on the blog as "Nil", but perhaps there's a full name you'd like me to use? 😄
n
yes I saw it everywhere (on blog, in singer...) thanks. I will stick with Nil (by the way full name is Nilesh) as I use that almost all the time.
d
OK, that works, just wanted to make sure you get the chance to have your last name included!
n
ah ok, i tend to leave out last name as it contains lots of
a
and majority of them silent 🤣
d
😄
n
There is mysql-logo.png is missing shell I add that when I create MR for https://gitlab.com/meltano/meltano/-/issues/2387 or do you want it separately? (i can send the logo to you if you wish)
d
Separately please! Let's keeps MRs focused
Thanks for catching that!
e
@douwe_maan I’m thinking I have the same issue. I have set up Meltano using Docker. Set up reverse proxy with Nginx and SSL. I’m having an issue like the following error on Chrome:
Copy code
Mixed Content: The page at '<https://example.com/extractors>' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint '<http://example.com/api/v1/version?include_latest=true>'. This request has been blocked; the content must be served over HTTPS.
Your help is greatly appreciated.
d
@ed_bergavera That suggests that Meltano doesn't realize it's behind SSL and should be building its URLs with
https://
instead of
http://
. Did you see the suggestion under https://meltano.com/docs/production.html#meltano-ui?
If you will be running Meltano UI behind a front-end (reverse) proxy that will be responsible for SSL termination (HTTPS), it is recommended that you enable the `ui.session_cookie_secure` setting so that session cookies used for authentication are only sent along with secure requests.
You may also need to change the `ui.forwarded_allow_ips` setting to get Meltano UI to realize it should use the
https
URL scheme rather than
http
in the URLs it builds.
Specifically, look into https://meltano.com/docs/settings.html#ui-forwarded-allow-ips
e
@douwe_maan Thanks for the response. Yes, we all set the options by putting them into an environment file and referencing it with Docker run. However, we turned our attention to PoC to run FB ads to Postgres, but we haven’t been successful yet. We keep getting failed output to store information to Postgres. I have attached a recent log.
d
Hmm, looks like it's tripping over the
age
column even before `target-postgres | psycopg2.errors.UndefinedColumn: column "age" does not exist`:
Copy code
target-postgres | INFO Table Schema Change [`ads_insights_age_and_gender`.`('age',)`:`age`] New column (took 4 millis)
target-postgres | WARNING FIELD COLLISION: Field `('age',)` exists in remote already. No compatible type found. Appending type suffix: `age__s`
target-postgres | WARNING FIELD COLLISION: Field `('age',)` exists in remote already. No compatible type found. Appending type suffix: `age__i`
target-postgres | INFO Table Schema Change [`ads_insights_age_and_gender`.`('age',)`:`age__s`] Splitting `age` into `age__i` and `age__s`. New column matches existing column path, but the types are incompatible. (took 13 millis)
Sounds like it doesn't like the fact the tap outputs
age
with two possible (incompatible) types: https://gitlab.com/meltano/tap-facebook/-/blob/master/tap_facebook/schemas/ads_insights_age_and_gender.json#L323-329
@ed_bergavera Are you interested in the age/gender breakdown, or would you be OK skipping it? You can accomplish that using
meltano select tap-facebook --exclude ads_insights_age_and_gender '*'
I don't know if the Facebook API actually returns both string and integer values for
age
, but https://github.com/singer-io/tap-facebook/commit/bfe3b36aede2577ece7d2d1a27efac9a0f81195f and https://github.com/singer-io/tap-facebook/commit/e798176d80d86017757de4e6bbfe033e8eb32a18 suggest that this may be the case
If
ads_insights_age_and_gender
is important to you, it's possible that a different variant of target-postgres (see https://meltano.com/plugins/loaders/postgres.html#alternative-variants) handles the multiple types better
e
@douwe_maan thanks for your insights. I'm in the impression that Meltano could just populate automatically the fields regardless of the structure of your source.
d
Taps inform targets of the schema of the records they'll be emitting using a SCHEMA message, which the target then uses to create the corresponding database tables, but in this case the tap outputs multiple types for the column in question which the target doesn't understand.
e
I mean, you don't have to worry about the structure of the source data the fact that Meltano can automatically fill those data to your target.
d
Meltano handles the communication between tap and target, but it's still the tap itself that's responsible for the structure of the data it emits, which needs to be compatible with the target that will create the appropriate database tables.
e
Oh, I see..that explains the issue here.
d
So in this case we need to either fix the tap to not claim that this column has 2 different types, or we can add support for this to the target, or use a different variant of the target that may already support it
Or, if age/gender breakdown is less important to you, you can explicitly exclude it in your pipeline, assuming the other tables don't have the same issue
Meltano supports overriding the schema in the catalog file: https://meltano.com/docs/plugins.html#schema-extra but this currently doesn't affect the SCHEMA message that the tap outputs
So there are ways forward that I'll gladly help you explore, but if this is a PoC just to see if it works, I suggest excluding the faulty table using
meltano select tap-facebook --exclude ads_insights_age_and_gender '*'
and trying again
e
We'll check that out. I appreciate your time and providing helpful suggestions 🙂
d
I've created a new issue that would allow us to override the broken schema for
age
using the existing
schema
extra in
meltano.yml
I linked to a few messages up: https://gitlab.com/meltano/meltano/-/issues/2469
Let me know if I can do anything else to help, I'd also happy to jump on a call one of these days!
e
Will do. Thanks again @douwe_maan
m
Hello @douwe_maan @ed_bergavera I am also getting two types "integer and string" columns for one column and i saw this discussion over this issue. @douwe_maan As you specify the specific reasons: "So in this case we need to either fix the tap to not claim that this column has 2 different types, or we can add support for this to the target, or use a different variant of the target that may already support it" I checked the types on schema but it's just single type specified( Integer) For the reference i am using tap-shopify and target-redshift. @edward_ryan @connor_flynn