Hey everyone! 👋
Hey everyone! 👋
I'm running into some trouble connecting to my Neon database from Power BI, and I was hoping someone might have some insights. I'm fairly new to this whole data stuff, so please bear with me if I'm not using all the right terms! 😅
Basically, I'm trying to import data into Power BI, but I keep getting this "PostgreSQL: Exception while reading from stream" error . It seems to start downloading fine, but then it just cuts out after about 5 minutes.
Here’s what I've tried so far (as per suggestions from the Neon support team and other sources):
- Switched from a pooled connection string to a direct one
- Added a custom SQL query to limit the data being imported
- Disabled the "Scale to Zero after 5 minutes of inactivity" feature
I'm not sure if the problem is with Power BI, Neon's configuration, or something else entirely 🤷♀️. I've reached out to both Power BI and Neon support, but haven't heard back yet, so I figured I'd see if anyone here has experienced something similar or has any tips for a newbie.
Any help would be greatly appreciated! Thanks in advance! 🙏😊
8 Replies
robust-apricot•7mo ago
Hi, sorry you are having trouble. How did you configure your connection from PowerBI (I am not familiar with the platform)? What does that configuration look like (without revealing your project ID or password). With other clients, there are sometimes some issues with connection configurations due to the Postgres driver. We try to capture these types of issues here: https://neon.tech/docs/connect/connection-errors
Neon
Connection errors - Neon Docs
This topic describes how to resolve connection errors you may encounter when using Neon. The errors covered include The endpoint ID is not specified Password authentication failed for user Couldn't co...
robust-apricot•7mo ago
I found one support ticket dealing with this issue specifically. Here is the Support advice that was provided:
"I understand that you're encountering a persistent "PostgreSQL: Exception while reading from stream" error when attempting to import data from your Neon database into Power BI in Import mode. I appreciate the detailed troubleshooting steps you've already taken, including switching to a direct connection string, limiting the data import, and disabling the "Scale to Zero" feature. Let me provide some additional insights and recommendations to help resolve this issue.
Connection Timeout and Latency: Since the error occurs after approximately five minutes, it could be related to connection timeouts or latency.
I recommend reviewing our connection errors documentation for guidance on addressing such issues. Specifically, ensure that your connection string includes parameters to handle timeouts effectively.
Power BI Settings: Verify that Power BI is configured to handle large datasets efficiently. Adjusting the data import settings or increasing the timeout duration in Power BI might help mitigate the issue."
Unfortunately, this did not seem to resolve the issue. The user tried from DBeaver - was successful - and concluded that the issue was with PowerBI.
If you're on a Neon paid plan, I recommend opening a support ticket to see if they can help you work through the issue. If you have Power BI support, you might also contact them.
continuing-cyan•7mo ago
Thanks for your reply ! The ticket is actually me 😅
I've been looking with Microsoft but we didn't understand yet, I'll post there if we find anything, for now I have no choice than reducing my data base under 70 millions raws (but according to online's forum I'm far from alone having this issue)
robust-apricot•7mo ago
Have you tried setting the command timeout to a higher value? https://learn.microsoft.com/en-us/power-query/connectors/postgresql#connect-using-advanced-options
Power Query PostgreSQL connector - Power Query
Provides basic information, prerequisites, and instructions on how to connect to your database, along with native query folding instructions and troubleshooting tips.
continuing-cyan•7mo ago
Yes !
Here is the query i'm using :
= PostgreSQL.Database(
"ep-red-dawn-a9b3qi54.gwc.azure.neon.tech:5432",
"Localia",
[
CommandTimeout = #duration(5, 0, 0, 0)
]
)
And a summary of what microsoft told me :
1.Try using server:port in connection string to Postgres database.
2.This might be due to some firewalls dropping packages please check with your firewall team to open the route between source and destination. Make sure the PostgreSQL server's postgresql.conf and pg_hba.conf files are correctly configured to allow connections from your IP address or network range.
Restart the PostgreSQL service after making any changes to these files.
3.Go to Edit Queries->Advanced Editor-> add timeout in the connection
Source = PostgreSQL.Database("server_name", "database_name", [CommandTimeout=#duration(5, 0, 0, 0)]),
4.Try to check whether there is any issues with your certificates.
5. You have a limit for Import mode - memory usage limited to your computer resources (RAM). So if you have 8 GB of RAM and your report consumes 9 GB then it will fail. You can check usage via Windows Task Manager -> Resource Monitor.
6. We suggest you to either optimizing the data imported or you can use mixed mode where you can import data in mixed mode(import + direct query)
None of this worked (except limit the database but i don't want to) So basically, they have no idea ^^'
Hello, in the power Bi diagnosis, i find this error :
DataMashup.Trace Information: 24579 : {"Start":"2025-03-04T14:42:28.4129501Z","Action":"Engine/IO/Db/PostgreSQL/AuthorizationError","ResourceKind":"PostgreSQL","ResourcePath":"ep-red-dawn-a9b3qi54.gwc.azure.neon.tech:5432;Localia","HostProcessId":"5212","PartitionKey":"Section1/Localia_Total/public_LOCALIA_localia","Server":"ep-red-dawn-a9b3qi54.gwc.azure.neon.tech:5432","Database":"Localia","ExceptionCode":"","Exception":"Npgsql.NpgsqlException (0x80004005): Exception while reading from stream
---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.\r\n at Npgsql.NpgsqlReadBuffer.<>cDisplayClass27_0.<<Ensure>gEnsureLong|0>d.MoveNext()\r\n at Npgsql.NpgsqlReadBuffer.<>cDisplayClass27_0.<<Ensure>gEnsureLong|0>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at Npgsql.NpgsqlConnector.<>cDisplayClass159_0.<<ReadMessage>gReadMessageLong|0>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Npgsql.NpgsqlDataReader.<>cDisplayClass37_0.<<Read>gReadLong|0>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Npgsql.NpgsqlDataReader.Read()\r\n at Microsoft.Mashup.Engine1.Library.Common.TracingDbDataReader.Read()\r\n at Microsoft.Mashup.Engine1.Library.Common.ProgressDbDataReader.Read()\r\n at Microsoft.OleDb.Serialization.DataReaderPageReader.ObjectPage.Read(IDataReader reader, Int32 rowCount)","ResourceExceptionKind":"None","ProductVersion":"2.140.405.0 (25.02)+ce8df7514817f043440bfe980ed72d2060b70360","ActivityId":"0234358c-dce9-4e47-9208-3369521fd243","Process":"Microsoft.Mashup.Container.NetFX45","Pid":4128,"Tid":1,"Duration":"00:00:00.0113523"}
so i don't know but maybe there's a problem with Neon Cloud after all ? 🤔 @Daniel
(i can send my full log if needed)
robust-apricot•7mo ago
Hi @AshDown, sorry is this is still blocking you. The best option here is to open another ticket with Neon Support, and please include your log. There's an option on the support ticket form to upload files.
https://console.neon.tech/app/projects?modal=support
Maybe with this additional information, they'll be better able to diagnose the issue.
continuing-cyan•7mo ago
Actually, I might have solve the issue, it seems to work if i'm using ODBC in PBi


robust-apricot•7mo ago
Great. Glad to hear!