Fix config not forwarded to with_path in DataAPI HTTP methods#87
Draft
Fix config not forwarded to with_path in DataAPI HTTP methods#87
Conversation
All HTTP methods (get, post, put, patch, delete and their async/file/video variants) in DataAPI were calling self.with_path(path, query=query) without forwarding the config parameter. This caused get_base_url() to use only self.config (which was None when SandboxClient() was created without config), ignoring any account_id provided at call time via the config argument. Fix: pass config=config to all self.with_path() calls so the merged config (self.config + call-time config) is used when constructing the base URL. Apply identical fix to the __data_api_async_template.py source template. Add regression tests in TestDataAPIConfigForwarding to verify that HTTP methods use call-time config for URL construction even when the instance was created without an account_id. Agent-Logs-Url: https://github.com/Serverless-Devs/agentrun-sdk-python/sessions/04987b1e-1f19-49af-8878-9513a91f6abf Co-authored-by: OhYee <13498329+OhYee@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix account id check in Sandbox.create method
Fix config not forwarded to with_path in DataAPI HTTP methods
Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sandbox.create(config=Config(account_id=...))raisedValueError: account id is not setdespite a valid config being passed, because allDataAPIHTTP methods built the request URL viaself.with_path(path, query=query)without forwardingconfig.with_path()already accepted and correctly mergedconfigintoget_base_url()— the callers just never passed it through.When
Sandbox.__get_client()returnsSandboxClient()(no config),self.confighas noaccount_id. The call-timeconfigreached auth/headers via_prepare_requestbut was silently dropped from URL construction, causing the error.Changes
agentrun/utils/data_api.py— Passconfig=configtoself.with_path()in all HTTP methods:get,post,put,patch,delete, and their_async,_file, and_videovariantsagentrun/utils/__data_api_async_template.py— Same fix in the async source templatetests/unittests/utils/test_data_api.py— AddedTestDataAPIConfigForwardingwith regression tests covering sync/async HTTP methods using call-timeconfigfor URL construction when the instance has noaccount_idWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
astral.sh/usr/bin/curl curl -LsSf REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either: